🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

WM_PAINT

Started by
5 comments, last by dpatte 23 years, 11 months ago
Ok, so I admit it, I''m new at this. I am familiar with Windows SDK programming, but noticed in NeHe''s framework there is no repainting explicitly done for a WM_PAINT message. How does OpenGL know that it has to repaint the scene when a GL window is uncovered for example?
Advertisement
swapbuffers(). That functions tells the card to swap the front and back buffers. Once that is done you are just waiting for a new screen refresh to see your things

Edited by - Gorg on August 2, 2000 10:08:02 AM
Thanks!

Ok - but in standard SDK programming, after drawing a window once, nothing automatically redraws the window when it gets corrupted (like when a window is exposed my moving another window out of the way) - it has to be manually redrawn each time.

In the case of ogl, though, it seems to be handling this automatically - where?

For example - draw an ogl window (not full screen) open another app, cover the ogl app window, then expose it again. in standard SDK programming, this would generate a WM_PAINT and I''d have to redraw manually using my sdk code - but in ogl this doesn''t seem necessary - what is handling this WM_PAINT?


In the tutorials there is no WM_PAINT because it''s drawed every time when swapbuffers() is called.

I also think it would be to slow to handle the WM_PAINT message with OGL (except for editors).
OK, I get it now.

On each pass through the message loop, if there is nothing to do, it does a swap buffers. This makes sure the screen stays updated with the last calculated display.

I get it now.

I did some experimenting, and noticed that it even does this when the screen is minimized! It doesn''t recalc, but it swaps buffers like crazy - i''ll do some more experimenting.
i do recommend calling swap buffers in the paint statment if u use a model dialog in your program othjerwise when the user drags a dialog over the screen there will be a black trail after it
I dunno if you noticed but in NeHe''s code, whenever it runs in a window, then WS_EX_TOPMOST is specified, meaning that nothing is ever drawn over it.

OGL windows only ever update when you call SwapBuffers() anyway.

========
Smidge
www.smidge-tech.co.uk
========
--Mr Smidge

This topic is closed to new replies.

Advertisement