PDA

View Full Version : noob question: gl contex creation



tomb4
09-05-2004, 02:17 AM
so how can I create glrc without creating a dummy window so that I can get all the extension entries before I create the normal rendering window?

GetDesktopWindow() should be the only solution, but once I got its hdc I failed to create glrc.

is there something I miss or a better solution, maybe?

lgrosshennig
09-05-2004, 05:06 AM
No, you cant.

tomb4
09-05-2004, 05:58 AM
Thanks for reply dude.
But AFAIK someone did that but I just cant remember how its done. And besides, why would I failed to create glrc with desktop hdc?

lgrosshennig
09-05-2004, 11:15 AM
AFAIK the only way to do what you want to do (in a reliable fashion) is to create a invisible window first.

You should not use the desktop window, because your process does not own the desktop window and SetPixelFormat() can only be called once in the whole lifetime of a window.

tomb4
09-05-2004, 06:23 PM
Problem solved. I just forgot to set the pixel format of desktop window.
But as you said, right, the pixelformat of desktop window can only be set once in its whole lifetime but, the second run works fine as well, and so did the third...
Very strange, huh? Maybe its not persistent or something?

lgrosshennig
09-06-2004, 07:41 AM
I am sorry, I have been to vague.

As long as you call it with the same pixelformat, everything should be fine (it may depend on the driver though) but if you, or any other software for that matter, try to set a different pixelformat it will fail (may depend on the driver too).

Therefore I think that it is a very ugly hack to abuse the desktop window for this kind of stuff.

Its of course just my personal opinion, you may do as you like.

tomb4
09-06-2004, 06:26 PM
Thanks.
I'll keep a copy of my previous version of initialization code in case failure occurs.