I was trying to use WGL_ARB_pbuffer for offscreen rendering with OpenGL,
but I was failed during initialization. Here is my code.wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC) wglGetProcAddress("wglGetExtensionsStringARB");
if(!wglGetExtensionsStringARB) return;
const GLubyte* extensions = (const GLubyte*) wglGetExtensionsStringARB(wglGetCurrentDC());
So actually this ends at 2nd line because wglGetExtensionsStringARB got NULL.
I have no idea why wglGetProcAddress doesn't work. I included "wglext.h" and also I defined as below at the header.PFNWGLGETEXTENSIONSSTRINGARBPROC pwglGetExtensionsStringARB = 0;
#define wglGetExtensionsStringARB pwglGetExtensionsStringARB
Why can't I use wglGetProcAddress as I intended??
wglGetProcAddress
requires an OpenGL rendering context; you need to call your wglCreateContext
and wglMakeCurrent
prior to calling wglGetProcAddress
. If you have not already setup an OpenGL context, wglGetProcAddress
will always return NULL
. If you're not sure if you have an OpenGL context yet (for example, if you're using a 3rd party framework/library), call wglGetCurrentContext
and check to make sure it's not returning NULL
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With