access violation upon calling wglChoosePixelFormatARB

Hi, I have been trying to use floating point pixel buffers for a few weeks now, pretty unsuccessfully. My latest venture involves a main app that is in win32 invoking a class that has a fpbuffer as a member. Compilation goes without any probems, unfortunately when I execute the program I get “Unhandled Exception in myprogram.exe: 0xC0000005: Access Violation”

This error occurs right after the call wglChoosePixelFormatARB(hWindowDC, attribList, NULL, 1, &format, &nformats);

This line is in the fpbuffer class implementation. hWindowDC is set using
hWindowDC = wglGetCurrentDC();

presumably if wglGetCurrentDC() fails hWindowDC should be NULL, however if I try to look at its value in the debugger I get a
CXX0017: Error: symbol “hWindowDC” not found
, which is strange because it is declared before the call.

The same PBuffer class works fine in an nVidia demo so I have to assume it is failing to find an appropriate device context… can anybody help me with this?

thanks,

Do you have a valid pointer for wglChoosePixelFormatARB?

do you mean valid parameter pointers?

format is declared as:
int format = 0;
nformat is:
unsigned int nformats;

attribList is:
int attribList[] =
{
WGL_RED_BITS_ARB,precision,
WGL_GREEN_BITS_ARB,precision,
WGL_BLUE_BITS_ARB,precision,
WGL_ALPHA_BITS_ARB,precision,
WGL_STENCIL_BITS_ARB,0,
WGL_DEPTH_BITS_ARB,0,
WGL_FLOAT_COMPONENTS_NV, true,
WGL_DRAW_TO_PBUFFER_ARB, true,
0,
};

I mean a valid function pointer for the wglChoosePixelFormatARB function. Are you calling wglGetProcAddress(“wglChoosePixelFormatARB”) somewhere before you actually use the function?

ah. good point. I was including glh_extensions but hadn’t realized I needed to initialize the extensions. Thanks.