SDL and OpenGL extensions

Hi people,

I’m having some trouble with OpenGL extensions via SDL. I’ve looked at
many opengl examples using SDL and they don’t have any code to
"activate" the extensions. So, does SDL initialize all the function
pointers itself ?

If yes, how do I use them ??

thanx–
-= Alexander Bierbrauer =-

Software Architect
http://www.polyfrag.com

You need to initialize the function pointers yourself using an SDL
helper routine:

PFNGLACTIVETEXTUREARBPROC glActiveTextureARB = NULL;
PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB = NULL;
PFNGLMULTITEXCOORD2IARBPROC glMultiTexCoord2iARB = NULL;
unsigned char *exts;
exts = glGetString(GL_EXTEINSIONS);
if (strstr((char *) exts, “GL_ARB_multitexture”)) {
glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)
SDL_GL_GetProcAddress (“glActiveTextureARB”);
glMultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC)
SDL_GL_GetProcAddress (“glMultiTexCoord2fARB”);
glMultiTexCoord2iARB = (PFNGLMULTITEXCOORD2IARBPROC)
SDL_GL_GetProcAddress (“glMultiTexCoord2iARB”);
}On Thu, Nov 07, 2002 at 12:57:45AM +0100, Alexander Bierbrauer wrote:

Hi people,

I’m having some trouble with OpenGL extensions via SDL. I’ve looked at
many opengl examples using SDL and they don’t have any code to
"activate" the extensions. So, does SDL initialize all the function
pointers itself ?

If yes, how do I use them ??

No - you have to do that yourself. I’ve asked Sam for a generic set of
extension string functions and a specific OpenGL extension query, but he’s
not likely to consider adding this to SDL 1.2 since it’s a non-bugfix sort
of thing.

These three links are to Project: Twilight CVS files; the license is very
liberal because we want people to use these files nearly wholesale, rather
than try to reinvent the wheel (poorly):

http://cvs.icculus.org/horde/chora/co.php/twilight/src/renderer/dyngl.c?rt=twilight&r=1.7

http://cvs.icculus.org/horde/chora/co.php/twilight/src/renderer/dyngl.h?rt=twilight&r=1.2

http://cvs.icculus.org/horde/chora/co.php/twilight/src/renderer/dglfuncs.h?rt=twilight&r=1.9

More than just dynamic extensions (though that is supported as well), this
provides full dynamic OpenGL binding at runtime. One of these days (or
months or years?) I will sit down and fully document this code and put it
online with some simple examples and a glfuncs.h suitable for use with the
sample code on gametutorials and (by request rather than any real desire
to consider touching that crap) the NeHe code.

Others with more time (and more patience for NeHe’s “coding talent”) are
welcome to beat me to it. =)On Thu, Nov 07, 2002 at 12:57:45AM +0100, Alexander Bierbrauer wrote:

I’m having some trouble with OpenGL extensions via SDL. I’ve looked at
many opengl examples using SDL and they don’t have any code to
"activate" the extensions. So, does SDL initialize all the function
pointers itself ?

If yes, how do I use them ??


Joseph Carter You’re entitled to my opinion

Most of us feel that marketing types are like a dangerous weapon - keep
’em unloaded and locked up in a cupboard, and only bring them out when
you need them to do a job.
– Craig Sanders

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20021106/b45980fb/attachment.pgp