Changeset 8814:04082b32ba30 in orange


Ignore:
Timestamp:
08/27/11 18:27:04 (3 years ago)
Author:
matejd <matejd@…>
Branch:
default
Convert:
117a5b05913f7c8572f26911d60496221452faba
Message:

Disabled get_selected_indices for now, crashes on larger datasets (adult.tab)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/orangeqt/plot3d.cpp

    r8812 r8814  
    1414typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); 
    1515PFNGLGETVERTEXATTRIBPOINTERPROC glVertexAttribPointer = NULL; 
    16 typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); 
    1716PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation = NULL; 
    1817PFNGLUNIFORM2FPROC glUniform2f = NULL; 
     18PFNGLDELETEBUFFERSPROC glDeleteBuffers = NULL; 
    1919 
    2020#define BUFFER_OFFSET(i) ((char *)NULL + (i)) 
     
    2727Plot3D::~Plot3D() 
    2828{ 
    29     // TODO: delete vbos 
     29    if (vbos_generated) 
     30    { 
     31        glDeleteBuffers(1, &vbo_selected_id); 
     32        glDeleteBuffers(1, &vbo_unselected_id); 
     33        glDeleteBuffers(1, &vbo_edges_id); 
     34    } 
    3035} 
    3136 
     
    6368void Plot3D::set_data(quint64 array_address, int num_examples, int example_size) 
    6469{ 
    65     this->data_array = reinterpret_cast<float*>(array_address); // 32-bit systems, endianness? 
     70    data_array = reinterpret_cast<float*>(array_address); // 32-bit systems, endianness? 
    6671    this->num_examples = num_examples; 
    6772    this->example_size = example_size; 
    68     this->selected_indices = QVector<bool>(num_examples); 
     73    selected_indices = QVector<bool>(num_examples); 
    6974 
    7075    // Load required extensions (OpenGL context should be up by now). 
     
    8085    glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)glXGetProcAddress((const GLubyte*)"glGetUniformLocation"); 
    8186    glUniform2f = (PFNGLUNIFORM2FPROC)glXGetProcAddress((const GLubyte*)"glUniform2f"); 
     87    glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)glXGetProcAddress((const GLubyte*)"glDeleteBuffers"); 
    8288#endif 
    8389} 
     
    8894                         bool x_discrete, bool y_discrete, bool z_discrete, bool use_2d_symbols) 
    8995{ 
    90     // TODO: delete vbos 
     96    if (vbos_generated) 
     97    { 
     98        glDeleteBuffers(1, &vbo_selected_id); 
     99        glDeleteBuffers(1, &vbo_unselected_id); 
     100        glDeleteBuffers(1, &vbo_edges_id); 
     101    } 
     102 
    91103    this->x_index = x_index; 
    92104    this->y_index = y_index; 
     
    95107    const float scale = 0.001; 
    96108 
    97     float* vbo_selected_data   = new float[num_examples * 144 * 13]; // TODO: better size approximation 
     109    float* vbo_selected_data   = new float[num_examples * 144 * 13]; 
    98110    float* vbo_unselected_data = new float[num_examples * 144 * 13]; 
    99111    float* vbo_edges_data      = new float[num_examples * 144 * 13]; 
     
    172184 
    173185        // No need for edges in selected examples (those are drawn fully opaque) 
    174         if (this->selected_indices[index]) 
     186        if (selected_indices[index]) 
    175187            continue; 
    176188 
     
    311323 
    312324QList<double> Plot3D::get_min_max_selected(const QList<int>& area, 
    313                                           const QMatrix4x4& mvp, 
    314                                           const QList<int>& viewport, 
    315                                           const QVector3D& plot_scale, 
    316                                           const QVector3D& plot_translation) 
     325                                           const QMatrix4x4& mvp, 
     326                                           const QList<int>& viewport, 
     327                                           const QVector3D& plot_scale, 
     328                                           const QVector3D& plot_translation) 
    317329{ 
    318330    float x_min = std::numeric_limits<float>::max(); 
     
    382394{ 
    383395    if (behavior == Plot::ReplaceSelection) 
    384         selected_indices.fill(false);//selected_indices = QVector<bool>(num_examples); 
     396        selected_indices.fill(false); 
    385397 
    386398    for (int index = 0; index < num_examples; ++index) 
     
    415427void Plot3D::unselect_all_points() 
    416428{ 
    417     this->selected_indices = QVector<bool>(num_examples); 
     429    selected_indices = QVector<bool>(num_examples); 
    418430} 
    419431 
    420432QList<bool> Plot3D::get_selected_indices() 
    421433{ 
    422     return this->selected_indices.toList(); 
     434    //return selected_indices.toList(); // TODO: this crashes on adult.tab 
     435    return QList<bool>(); 
    423436} 
    424437 
Note: See TracChangeset for help on using the changeset viewer.