SDL_GL_GetProcAddress , can't get it to work right

If I attempt to use this as it’s demonstrated in the documentation, I get a
crash in the C runtime when I try to use the functions.

SDL_GL_GetProcAddress

typedef void (*GL_ActiveTextureARB_Func)(unsigned int);
GL_ActiveTextureARB_Func glActiveTextureARB_ptr = 0;

glActiveTextureARB_ptr=(GL_ActiveTextureARB_Func)
SDL_GL_GetProcAddress(“glActiveTextureARB”);

glActiveTextureARB_ptr(GL_TEXTURE0_ARB);

I put the first two lines in a header file, the compiler complains about it
already being defined in every file. I then put it at the top of the CPP
main file, and then the other CPP files complain that they can’t find the
function. So I threw the entire thing into the beginning of C++ class that
uses it (all but the last line) and then when I tried to use the last line
it goes kaput.

So I dumped all that out, then tried the glext.h and linked against MESA.
Which worked. Well sorta, I don’t know if the output from MESA is correct.
I had to put this line in glext.h for it to work:
#define GL_GLEXT_PROTOTYPES 1

Using MS’s opengl32.lib/opengl32.dll produces link errors.

So…

What is the correct way to use SDL_GL_GetProcAddress?_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

I think your problem is that under windows you must add the APIENTRY macro
like:
typedef void (APIENTRY * glMultiTex…)( void )
It should work with this. Under Unix this is not required.On Thu, 24 May 2001, Kisai wrote:

If I attempt to use this as it’s demonstrated in the documentation, I get a
crash in the C runtime when I try to use the functions.

SDL_GL_GetProcAddress

typedef void (*GL_ActiveTextureARB_Func)(unsigned int);
GL_ActiveTextureARB_Func glActiveTextureARB_ptr = 0;

glActiveTextureARB_ptr=(GL_ActiveTextureARB_Func)
SDL_GL_GetProcAddress(“glActiveTextureARB”);

glActiveTextureARB_ptr(GL_TEXTURE0_ARB);

I put the first two lines in a header file, the compiler complains about it
already being defined in every file. I then put it at the top of the CPP
main file, and then the other CPP files complain that they can’t find the
function. So I threw the entire thing into the beginning of C++ class that
uses it (all but the last line) and then when I tried to use the last line
it goes kaput.

So I dumped all that out, then tried the glext.h and linked against MESA.
Which worked. Well sorta, I don’t know if the output from MESA is correct.
I had to put this line in glext.h for it to work:
#define GL_GLEXT_PROTOTYPES 1

Using MS’s opengl32.lib/opengl32.dll produces link errors.

So…

What is the correct way to use SDL_GL_GetProcAddress?


Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com