PDA

View Full Version : wglGetProcAddress or GetProcAddress?



Mezz
06-23-2002, 10:30 AM
Does it matter which I use?

I know that with wglGetProcAddress you don't need to do a LoadLibrary() and you don't need to specify your dll handle in the call, but is there any difference or problems with using one rather than the other?

Thanks.

-Mezz

Bob
06-23-2002, 11:02 AM
GetProcAddress will load a function from a DLL that is explicitly marked as an export. GL functions are not necessarily marked as exports.

Bob
06-23-2002, 11:04 AM
Just to make it clear. I'm talking about the functions not in opengl32.dll. That is, extensions and OpenGL 1.2 and above.

You should be able to load OpenGL 1.1 functions with GetProcAddress, since they are exports in opengl32.dll.

Mezz
06-23-2002, 11:32 AM
So, can I reliably use wglGetProcAddress() for all GL functions - whether they're nVidia extensions, ATI extensions, core 1.1/1.2/1.3 even wgl extensions themselves (pbuffer etc.)?

PS: I say reliably, I mean can I use it consistently for them all - I'm under no delusion that trying to wglGetProcAddress("glTrackMatrixNV")
will return anything but NULL on ATI cards.

Thanks

-Mezz

Bob
06-25-2002, 12:56 AM
Yes, wglGrtProcAddress will work for all GL functions, since that's what it's there for.

wglGetProcAddress("glTrackMatrixNV") should return NULL on implementations that does not support that extension.

Mezz
06-25-2002, 03:59 AM
Thanks Bob, I'm using wglGetProc... for everything now.

-Mezz