From f7c16d5a83a5213976f0a886efdb23a630c9f58b Mon Sep 17 00:00:00 2001 From: apo Date: Tue, 5 Sep 2006 08:19:23 +0000 Subject: [PATCH] To fix compilation bug in case of Mandriva64 usage. The used "glXGetProcAddressARB" function is conditionally declared in the "GL/glx.h". So, to be sure that the function will be acessible in compile time it is necessary to define the "GLX_GLXEXT_LEGACY" preporcessor variable before including the "GL/glx.h" header file. --- src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx | 67 +++++++++++++------ 1 file changed, 47 insertions(+), 20 deletions(-) diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx index 401ca646..680a21ab 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx @@ -51,6 +51,9 @@ #include #include +#ifndef GLX_GLXEXT_LEGACY +#define GLX_GLXEXT_LEGACY +#endif #include #ifndef VTK_IMPLEMENT_MESA_CXX @@ -138,43 +141,67 @@ static PFNGLDELETEBUFFERSARBPROC vglDeleteBuffersARB = NULL bool InitializeARB() { - //void* OpenGLLibrary = dlopen( "libGL.so", RTLD_LAZY ); - vglShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)glXGetProcAddressARB( (const GLubyte*)"glShaderSourceARB" ); + if( !vglShaderSourceARB ) + return false; + vglCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)glXGetProcAddressARB( (const GLubyte*)"glCreateShaderObjectARB" ); + if( !vglCreateShaderObjectARB ) + return false; + vglCompileShaderARB = (PFNGLCOMPILESHADERARBPROC)glXGetProcAddressARB( (const GLubyte*)"glCompileShaderARB" ); + if( !vglCompileShaderARB ) + return false; + vglCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)glXGetProcAddressARB( (const GLubyte*)"glCreateProgramObjectARB" ); + if( !vglCreateProgramObjectARB ) + return false; + vglAttachObjectARB = (PFNGLATTACHOBJECTARBPROC)glXGetProcAddressARB( (const GLubyte*)"glAttachObjectARB" ); + if( !vglAttachObjectARB ) + return false; + vglLinkProgramARB = (PFNGLLINKPROGRAMARBPROC)glXGetProcAddressARB( (const GLubyte*)"glLinkProgramARB" ); + if( !vglLinkProgramARB ) + return false; + vglUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)glXGetProcAddressARB( (const GLubyte*)"glUseProgramObjectARB" ); + if( !vglUseProgramObjectARB ) + return false; + vglGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC)glXGetProcAddressARB( (const GLubyte*)"glGetObjectParameterivARB" ); + if( !vglGetObjectParameterivARB ) + return false; + vglGetInfoLogARB = (PFNGLGETINFOLOGARBPROC)glXGetProcAddressARB( (const GLubyte*)"glGetInfoLogARB" ); + if( !vglGetInfoLogARB ) + return false; + vglGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC)glXGetProcAddressARB( (const GLubyte*)"glGetAttribLocationARB" ); + if( !vglGetAttribLocationARB ) + return false; + vglVertexAttrib1fARB = (PFNGLVERTEXATTRIB1FARBPROC)glXGetProcAddressARB( (const GLubyte*)"glVertexAttrib1fARB" ); + if( !vglVertexAttrib1fARB ) + return false; vglGenBuffersARB = (PFNGLGENBUFFERSARBPROC)glXGetProcAddressARB( (const GLubyte*)"glGenBuffersARB" ); + if( !vglGenBuffersARB ) + return false; + vglBindBufferARB = (PFNGLBINDBUFFERARBPROC)glXGetProcAddressARB( (const GLubyte*)"glBindBufferARB" ); + if( !vglBindBufferARB ) + return false; + vglBufferDataARB = (PFNGLBUFFERDATAARBPROC)glXGetProcAddressARB( (const GLubyte*)"glBufferDataARB" ); + if( !vglBufferDataARB ) + return false; + vglDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC)glXGetProcAddressARB( (const GLubyte*)"glDeleteBuffersARB" ); + if( !vglDeleteBuffersARB ) + return false; - if( vglShaderSourceARB && - vglCreateShaderObjectARB && - vglCompileShaderARB && - vglCreateProgramObjectARB && - vglAttachObjectARB && - vglLinkProgramARB && - vglUseProgramObjectARB && - vglGetObjectParameterivARB && - vglGetInfoLogARB && - vglGetAttribLocationARB && - vglVertexAttrib1fARB && - vglGenBuffersARB && - vglBindBufferARB && - vglBufferDataARB && - vglDeleteBuffersARB ) - return true; - - return false; + return true; }; static bool IsARBInitialized = InitializeARB(); -- 2.39.2