Changeset 8894:df714ae46dbc in orange


Ignore:
Timestamp:
09/02/11 14:55:12 (3 years ago)
Author:
matejd <matejd@…>
Branch:
default
Convert:
b9de85c4d4daebefb0d68c76c2ab406cb18e2c66
Message:

Arranged preprocessor defines so that plot3d.cpp compiles on Windows.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/orangeqt/plot3d.cpp

    r8848 r8894  
    44#include <QGLFormat> 
    55 
    6 #ifdef __APPLE__ // OpenGL framework 
     6#ifdef _WIN32 // Should be defined by most Windows compilers 
     7#include <GL/glext.h> 
     8#elif defined __APPLE__ // OpenGL framework 
    79#include <OpenGL/glext.h> 
    8 #else 
     10#else // Linux 
    911#include <GL/glx.h> 
    10 #include <GL/glxext.h> // TODO: Windows? 
     12#include <GL/glxext.h> 
    1113#include <GL/glext.h> 
    12  
     14#endif 
     15 
     16#if !defined __APPLE__ // Windows and Linux 
    1317PFNGLGENBUFFERSARBPROC glGenBuffers = NULL; 
    1418PFNGLBINDBUFFERPROC glBindBuffer = NULL; 
     
    2125PFNGLUNIFORM2FPROC glUniform2f = NULL; 
    2226PFNGLDELETEBUFFERSPROC glDeleteBuffers = NULL; 
    23  
    24 #endif //__APPLE__ 
     27#endif 
    2528 
    2629#define BUFFER_OFFSET(i) ((char *)NULL + (i)) 
     
    7376    // Load required extensions (OpenGL context should be up by now). 
    7477#ifdef _WIN32 
    75     // TODO: wglGetProcAddress 
    76 #else 
    77 #ifdef __APPLE__ 
     78    glGenBuffers = (PFNGLGENBUFFERSARBPROC)wglGetProcAddress("glGenBuffers"); 
     79    glBindBuffer = (PFNGLBINDBUFFERPROC)wglGetProcAddress("glBindBuffer"); 
     80    glBufferData = (PFNGLBUFFERDATAPROC)wglGetProcAddress("glBufferData"); 
     81    glVertexAttribPointer = (PFNGLGETVERTEXATTRIBPOINTERPROC)wglGetProcAddress("glVertexAttribPointer"); 
     82    glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYARBPROC)wglGetProcAddress("glEnableVertexAttribArray"); 
     83    glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYARBPROC)wglGetProcAddress("glDisableVertexAttribArray"); 
     84    glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)wglGetProcAddress("glGetUniformLocation"); 
     85    glUniform2f = (PFNGLUNIFORM2FPROC)wglGetProcAddress("glUniform2f"); 
     86    glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)wglGetProcAddress("glDeleteBuffers"); 
     87#elif defined __APPLE__ 
    7888// Should check if the extensions are available. 
    7989#else 
     
    8797    glUniform2f = (PFNGLUNIFORM2FPROC)glXGetProcAddress((const GLubyte*)"glUniform2f"); 
    8898    glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)glXGetProcAddress((const GLubyte*)"glDeleteBuffers"); 
    89 #endif // __APPLE__ 
    90 #endif // _WIN32 
     99#endif 
    91100} 
    92101 
     
    112121    this->z_index = z_index; 
    113122 
    114     const float scale = 0.001; 
     123    const float scale = 0.001f; 
    115124 
    116125    float* vbo_selected_data   = new float[num_examples * 144 * 13]; 
     
    130139    for (int index = 0; index < num_examples; ++index) 
    131140    { 
    132         if (valid_data != NULL and !valid_data[index]) // Skip invalid examples 
     141        if (valid_data != NULL && !valid_data[index]) // Skip invalid examples 
    133142            continue; 
    134143 
     
    384393                                           const QVector3D& plot_translation) 
    385394{ 
    386     float x_min = std::numeric_limits<float>::max(); 
    387     float x_max = std::numeric_limits<float>::min(); 
     395    float x_min = std::numeric_limits<float>::infinity(); 
     396    float x_max = -std::numeric_limits<float>::infinity(); 
    388397    float y_min = x_min; 
    389398    float y_max = x_max; 
Note: See TracChangeset for help on using the changeset viewer.