Advertisement

Drawing the scene in the main loop or using WM_PAINT !

Started by January 04, 2002 01:50 PM
2 comments, last by mozert 23 years, 1 month ago
hi.. in most opengl tutorials i allways notice the use of the PeekMessage function, and also notice that the Drawing Procedure is in the main loop... but.. is there a real/serious problem if we put the Drawing Procedure in the WM_PAINT message ? (me, i dont see any probem) what is the comparison, in terms of performance, simplicity ? ok. ciao to all :-P
The WM_PAINT message doesn''t get sent very often. Either something has to cause the window to need to be redrawn, or somwhere in your code you force the WM_PAINT message to be sent. Forcing the WM_PAINT message to be sent may cause windows to do some of it''s own drawing as well (I''m not sure on this though). I would think that all drawing is best done in the main loop rather than by using the WM_PAINT message.

j.w.
Advertisement
What about using InvalidateRect( ) to redraw just the viewport rectangle?
Just use main loop, windows paint messages get you a considerably lower framerate. I won''t explain it all, go find yourself an article. I''ve read it in at least three books.

Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"

This topic is closed to new replies.

Advertisement