• Advertisement

Archived

This topic is now archived and is closed to further replies.

Loosing Drawing Context

This topic is 5150 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
I have the same problem and I think that you should take a
new DC when you begin drawing the new scene. A think you
should try using DirectDraw for 2D drawing. Is much faster.

Share this post


Link to post
Share on other sites
Are you talking about the fact that when you perform an "ALT-TAB" an you come back with another alt tab to you app your scene is not displayed anymore ?

If so you could take a look to the NEHE tutorials for example.



Car Physics Sample Engine

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement