Skip to main content
gamedev.net
🔒 Locked

Loosing Drawing Context

Started by Prozak 4 replies 300+ views
Original Post
Prozak
Prozak
Hi all, i''m using OpenGL under Windows XP, coding under VStudio C++. How do I detect that my window has lost its Drawing Context? This sometimes happens, right? Probably a message is sent to the window, and then we reaquire the drawing context right? Thanks for any tips on this...

[Hugo Ferreira][Positronic Dreams][Colibri 3D Engine][Entropy HL2 MOD][Yann L.][Enginuity]
The most irrefutable evidence that there is intelligent life in the Universe is that they haven''t contacted us!

Prozak
Prozak
ya, NEHE explains that when we exit full screen mode, we lose our DC.

I''m looking for examples where that happens in windowed mode. Sometimes we do lose our DC in windowed mode, and there must be ways for our window to become aware of such an event... i presume.


[Hugo Ferreira][Positronic Dreams][Colibri 3D Engine][Entropy HL2 MOD][Yann L.][Enginuity]
The most irrefutable evidence that there is intelligent life in the Universe is that they haven''t contacted us!

iNsAn1tY
iNsAn1tY
Do you mean DC as in Device Context? Which you get by calling GetDC at the start of the program, after you create the window? Because if it is, then I''m pretty sure that if you''re using Win32, and you specify CS_OWNDC in the style attribute of the window class, your window will never lose the DC associated with it (because the DC is unique to your window). I tried switching to fullscreen mode and back again with my OpenGL engine, and I didn''t lose the hDC.

Can you give an example of when you might lose the hDC in windowed mode? The only time I can think of this happening is when the window is destroyed and recreated to set different style parameters like WS_POPUP or WS_OVERLAPPEDWINDOW. Then it''s pretty obvious that you''d lose it, as the hWnd you got it from would have been destroyed. I just handle this in my window creation/destruction code...


Windows 95 - 32 bit extensions and a graphical shell for a 16 bit patch
to an 8 bit operating system originally coded for a 4 bit microprocessor,
written by a 2 bit company that can''t stand 1 bit of competition.
My opinion is a recombination and regurgitation of the opinions of those around me. I bring nothing new to the table, and as such, can be safely ignored.[ Useful things - Firefox | GLee | Boost | DevIL ]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.