Hi there,
I’ve encountered a rather frustrating problem with the function
"SDL_GL_GetProcaddress" in SDL 1.2.6, with the NVIDIA 5336 drivers on gentoo
linux(i have not had chance to test it on any other distro’s).
I am trying to obtain an ARB_vertex_program function using it. However, i
always end up with a NULL address being returned.
However, when i try and get the same function using glut and
glXGetProcAddressARB, then it returns an address to the function fine.
In either case, when i get the list of extensions supported by my drivers,
ARB_vertex_program is indeed listed there.
I’m a bit puzzled as to why this problem is occuring. If it was a driver
issue, then surely i wouldn’t be able to get the function at all…
Does anyone have any ideas?
Here is the code i am using to test :
// test.c
// Test Getting an ARB_vertex_program function
//#define SDL_METHOD
// Compile test SDL version with :
// gcc -DSDL_METHOD sdl-config --libs
test.c -o test
//#define GLUT_METHOD
// Compile test GLUT version with :
// gcc -DGLUT_METHOD -lGL -lGLU -lglut test.c -o test
#ifdef GLUT_METHOD
#include <GL/glut.h>
#include <stdio.h>
#define GET_GL_PROC(name) glXGetProcAddressARB(name)
#endif
#ifdef SDL_METHOD
#include <SDL/SDL.h>
#define GET_GL_PROC(name) SDL_GL_GetProcAddress(name)
#endif
void *extgl_GetProcAddress(char name)
{
printf(“Getting Proc Address for : %s\n”, name);
void t = (void)GET_GL_PROC((char)name);
if (t == NULL)
{
printf(“Couldn’t get %s!\n”, name);
}
printf(“PROC: %d\n”, t);
return t;
}
int main(int argc, char *argv)
{
/ Initialize library’s */
#ifdef GLUT_METHOD
glutInit(&argc, argv);
glutInitWindowPosition(100, 100);
glutInitWindowSize(512, 400);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
int windowID = glutCreateWindow(“test getting extension”);
#endif
#ifdef SDL_METHOD
SDL_Init(SDL_INIT_VIDEO);
if (SDL_GL_LoadLibrary("libGL.so") == -1 &&
SDL_GL_LoadLibrary("libGL.so.1") == -1)
{
printf("Error loading GL library: %s\n", SDL_GetError());
return 1;
}
#endif
/* Call the test function */
if (extgl_GetProcAddress("glGetProgramivARB") == NULL)
{
printf("Could not get test ARB_vertex_program function\n");
return 1;
}
/* Cleanup, if neccesary */
#ifdef SDL_METHOD
SDL_Quit();
#endif
return 0;
}
Thanks for any help,
-James