From: Leonardo Florez-Valencia Date: Fri, 26 Dec 2014 16:59:13 +0000 (+0100) Subject: OpenGL and MS-Windows nearly finished X-Git-Tag: v0.1~429 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=9ec64adf0f5938ebb468de3a52531b9b62babcef;p=cpPlugins.git OpenGL and MS-Windows nearly finished --- diff --git a/lib/cpPlugins/Extensions/Visualization/OpenGLMeshMapper.hxx b/lib/cpPlugins/Extensions/Visualization/OpenGLMeshMapper.hxx index 3fb5264..f1f0468 100644 --- a/lib/cpPlugins/Extensions/Visualization/OpenGLMeshMapper.hxx +++ b/lib/cpPlugins/Extensions/Visualization/OpenGLMeshMapper.hxx @@ -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 ) {