views:

43

answers:

2
+2  A: 

I've got a dormant brain cell from reading Petzold 15 years ago that just sprang back to life. The DC from CreateDC() is restricted. Good for getting info about the display device, measurement, that sort of stuff. Not good to use as a regular painting DC. You almost certainly need GetDC().

Hans Passant
Thank you! Of all the obscure things the Windows "universal object handle" paradigm leaves undocumented -- one is led to believe that any DC would work for this purpose.
i_photon
+1  A: 

My current OpenGL 3+ initialization routine doesn't require a dummy window. You can simply attempt to make a second RC and make it current using the DC of the real window. Take a look at the OpenGL wiki Tutorial: OpenGL 3.1 The First Triangle (C++/Win)

Duracell
Thanks for the reply. I forgot to mention that I am trying to create a context system that doesn't attach itself to a window, as this leads to a much cleaner initialization sequence (primarily an effort to further separate graphics from the UI itself). However, I have found that wiki to be a valuable documentation many times.
i_photon
OK. Is that possible? If you come up with a solution could you update your question with it? I'd be very interested in it.
Duracell
My question has been updated with an explanation of the solution.
i_photon