wglGetProcAddress or GetProcAddress?

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?



GetProcAddress will load a function from a DLL that is explicitly marked as an export. GL functions are not necessarily marked as exports.

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.

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.



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.

Thanks Bob, I’m using wglGetProc… for everything now.