]> Creatis software - cpPlugins.git/commitdiff
OpenGL and MS-Windows nearly finished
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Fri, 26 Dec 2014 16:59:13 +0000 (17:59 +0100)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Fri, 26 Dec 2014 16:59:13 +0000 (17:59 +0100)
lib/cpPlugins/Extensions/Visualization/OpenGLMeshMapper.hxx

index 3fb526413eff71c2023f0511244aca82c99ce7bf..f1f04682994a47281340c10c22a287afd3af0009 100644 (file)
@@ -563,10 +563,59 @@ _ConfigureOpenGL( )
   if( input == NULL )
     return( false );
 
+#ifdef _WIN32 
+  // get pointers to GL functions
+  glGenBuffers =
+    ( PFNGLGENBUFFERSARBPROC )wglGetProcAddress( "glGenBuffers" );
+  glBindBuffer =
+    ( PFNGLBINDBUFFERARBPROC )wglGetProcAddress( "glBindBuffer" );
+  glBufferData =
+    ( PFNGLBUFFERDATAARBPROC )wglGetProcAddress( "glBufferData" );
+  glBufferSubData =
+    ( PFNGLBUFFERSUBDATAARBPROC )wglGetProcAddress( "glBufferSubData" );
+  glDeleteBuffers =
+    ( PFNGLDELETEBUFFERSARBPROC )wglGetProcAddress( "glDeleteBuffers" );
+  glGetBufferParameteriv =
+    ( PFNGLGETBUFFERPARAMETERIVARBPROC )wglGetProcAddress(
+      "glGetBufferParameteriv"
+      );
+  glMapBuffer =
+    ( PFNGLMAPBUFFERARBPROC )wglGetProcAddress( "glMapBuffer" );
+  glUnmapBuffer =
+    ( PFNGLUNMAPBUFFERARBPROC )wglGetProcAddress( "glUnmapBuffer" );
+
+  // check once again VBO extension
+  if(
+    glGenBuffers != NULL &&
+    glBindBuffer != NULL &&
+    glBufferData != NULL &&
+    glBufferSubData != NULL &&
+    glMapBuffer != NULL &&
+    glUnmapBuffer != NULL &&
+    glDeleteBuffers != NULL &&
+    glGetBufferParameteriv != NULL
+    )
+    this->VBOSupported = true;
+  else
+    this->VBOSupported = false;
+
+  // check EXT_swap_control is supported
+  /* TODO: really needed?
+     wglSwapIntervalEXT =
+     ( PFNWGLSWAPINTERVALEXTPROC )wglGetProcAddress( "wglSwapIntervalEXT" );
+     wglGetSwapIntervalEXT =
+     ( PFNWGLGETSWAPINTERVALEXTPROC )wglGetProcAddress(
+     "wglGetSwapIntervalEXT"
+     );
+     if( wglSwapIntervalEXT != NULL && wglGetSwapIntervalEXT != NULL )
+     wglSwapIntervalEXT( 0 );
+  */
+#else // _WIN32
   // Check if VBO ( Vertex Buffer Object ) is supported
   std::string str = ( const char* )( glGetString( GL_EXTENSIONS ) );
   this->VBOSupported =
     ( str.find( "GL_ARB_vertex_buffer_object" ) != std::string::npos );
+#endif // _WIN32 
 
   if( this->VBOSupported )
   {