OpenGL without a window?

Is it possible to use a Device Context for a Display Adapter (not a particular window’s DC) with OpenGL? The primary reason I am trying to do this is that I want to render OpenGL on multiple monitors, but the monitors are not necessarily members of the Windows desktop monitor group (and thus cannot have windows on them). Here’s some of my test code. Everything seems to work until I call wglMakeCurrent().

dc = CreateDC( _T("\\.\DISPLAY2"), NULL, NULL, NULL );
pixelFormat = ChoosePixelFormat (dc, &pfd);
SetPixelFormat (dc, pixelFormat, &pfd);
rc = wglCreateContext (dc);
wglMakeCurrent (dc, rc);

wglMakeCurrent() returns false, and a call to GetLastError() returns 3221684230, which I haven’t been able to decipher – there is no documentation on errors returned by wglMakeCurrent(), and using FormatMessage() does not reveal anything about this error code. It’s weird… it’s almost as if MS would rather I didn’t use OpenGL ;-).

Thanks in advance.

You can create rendering context for window or bitmap DC only. Only rendering to a window will be accelerated, hovewer. The reason is that your videocard needs a direct connection to the render target, and this can be only existing window(they must not be visible, though).
Of course, you can create pbuffers or use the render to framebuffer extension, but you still need a valid rc first to query the extensions :frowning:

Originally posted by Zengar:
You can create rendering context for window or bitmap DC only. Only rendering to a window will be accelerated, hovewer. The reason is that your videocard needs a direct connection to the render target, and this can be only existing window(they must not be visible, though).
Of course, you can create pbuffers or use the render to framebuffer extension, but you still need a valid rc first to query the extensions :frowning:

So… is it possible to get it accelerated if I get to manipulate pbuffers and framebuffers and a valid rc? Would you tell-me some book (or net address) where I could learn more about pbuffers and framebuffers?

Thanks a lot.

Did you find any good code or resources that helped? I just posted “reading and writing to the video frame buffer” and your solution may also help me-

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.