SDL_GL_GetProcAddress()

Started by
4 comments, last by Kid A 22 years, 1 month ago
I am having problems using SDL_GL_GetProcAddress() to get function addresses of opengl extensions. The sample on libsdl.org crashes when i try it. It says to do something like
    
typedef void (*glActiveTextureARB_Func)(unsigned int);
.
.
.
glActiveTextureARB_Func glActiveTextureARB_ptr =
    (glActiveTextureARB_Func)SDL_GL_GetProcAddress("glActiveTextureARB");
    
Trying to use the function pointer now creates an exception ... I don't really get how this should work, cos in glExt.h glActiveTextureARB() is defined as __stdcall but this declare doesnt have that so of course it's going to fail when it attempts to call it? Currently my drawing code that uses standard gl functions works fine ... so I have a console but no game map polygons :-( Would appreciate any help from someone who has got this working, Thanks, EDIT: formatting Edited by - Kid A on February 18, 2002 5:20:26 PM
Advertisement
Called all the relevant SDL setup functions? And checked return values?

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]
Hmm I have the extensions being called now, added __stdcall if on win32 and its happy.... but it still doesnt work.

As far as I can tell SDL is initialising fine ... the window shows up and drawing my console and fonts works fine, its only the code that draws the main level that doesnt display anything ... and it''s the only code that uses extensions. No OpenGL calls I''m making return any sort of error value ... and the rendering code in question worked before I started to port to SDL and it hasn''t been touched, only window creation and the main loop ... so its annoying (yes the rendering code is being reached), I think I''ll have to stop using extensions and make sure the basic drawing works, then add the use of extensions ... *sigh*

I need an SDL guru :-(

Oh and where can I get OpenGL 1.3 libraries for msvc++? cos I have a bad feeling its something to do with having OpenGL 1.1 libraries or something and mapping extension functions which have become part of the spec in 1.3 ...... probably just me though

Also I may try using SDL_GL_LoadLibrary() and mapping every function with SDL_GL_GetProcAddress(), that maaay help but who knows

Thanks for any help,
quote:Original post by Kid A
Oh and where can I get OpenGL 1.3 libraries for msvc++? cos I have a bad feeling its something to do with having OpenGL 1.1 libraries or something and mapping extension functions which have become part of the spec in 1.3 ...... probably just me though
You can''t get 1.3 libraries for MSVC. The most recent version available is 1.1. OpenGL 1.2 and 1.3 features are available through the extension mechanism.
Maybe a stupid question, but have you checked the returned function pointer for not beeing NULL?
I''m not sure but GL_GetProcAdress may need a properly initialised rendering context. Do you call it after the standard OGL initialisation code ?

This topic is closed to new replies.

Advertisement