From: ouv Date: Mon, 5 Sep 2005 04:58:57 +0000 (+0000) Subject: Using dlopen() and dlsym() for loading OpenGL shader functions X-Git-Tag: BR-D5-38-2003_D2005-12-09~34 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3b7cf66b887460e06ecd4b48022e6ed2b1629ea2;p=modules%2Fvisu.git Using dlopen() and dlsym() for loading OpenGL shader functions --- diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx index 4be6deb0..f3bf63c9 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx @@ -58,12 +58,12 @@ extern "C" { } #endif +#include + #include #include #include -#define ARB_PROGRAM - #ifndef VTK_IMPLEMENT_MESA_CXX vtkCxxRevisionMacro(VISU_OpenGLPointSpriteMapper, "$Revision$"); vtkStandardNewMacro(VISU_OpenGLPointSpriteMapper); @@ -226,9 +226,8 @@ void initShader() glProgramStringARB( GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, size, shader ); - /* - cout << "Shader :" << endl; + cout << "Shader from " << fileName << endl; for( int i = 0; i < size; i++ ) cout << shader[i]; cout << endl; @@ -291,11 +290,21 @@ void VISU_OpenGLPointSpriteMapper::InitializeExtensions() return; } + void* libHandle = dlopen( "libGL.so", RTLD_NOW ); + + glGenProgramsARB = (PFNGLGENPROGRAMSARBPROC)dlsym( libHandle, "glGenProgramsARB" ); + glDeleteProgramsARB = (PFNGLDELETEPROGRAMSARBPROC)dlsym( libHandle, "glDeleteProgramsARB"); + glBindProgramARB = (PFNGLBINDPROGRAMARBPROC)dlsym( libHandle, "glBindProgramARB"); + glProgramStringARB = (PFNGLPROGRAMSTRINGARBPROC)dlsym( libHandle, "glProgramStringARB"); + glProgramEnvParameter4fARB = (PFNGLPROGRAMENVPARAMETER4FARBPROC)dlsym( libHandle, "glProgramEnvParameter4fARB"); + + /* glGenProgramsARB = (PFNGLGENPROGRAMSARBPROC)glXGetProcAddressARB((const GLubyte*)"glGenProgramsARB"); glDeleteProgramsARB = (PFNGLDELETEPROGRAMSARBPROC)glXGetProcAddressARB((const GLubyte*)"glDeleteProgramsARB"); glBindProgramARB = (PFNGLBINDPROGRAMARBPROC)glXGetProcAddressARB((const GLubyte*)"glBindProgramARB"); glProgramStringARB = (PFNGLPROGRAMSTRINGARBPROC)glXGetProcAddressARB((const GLubyte*)"glProgramStringARB"); glProgramEnvParameter4fARB = (PFNGLPROGRAMENVPARAMETER4FARBPROC)glXGetProcAddressARB((const GLubyte*)"glProgramEnvParameter4fARB"); + */ initShader(); setShaderConstants(); @@ -869,7 +878,7 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(int idx, glEnable( GL_VERTEX_PROGRAM_ARB ); - glColor4f( 1.0, 1.0, 1.0, 1.0 ); + //glColor4f( 1.0, 1.0, 1.0, 1.0 ); glBindProgramARB( GL_VERTEX_PROGRAM_ARB, shaderId );