Jump to content
  • Advertisement
Sign in to follow this  
Kincaid

Best Place for Render Call ??

This topic is 3716 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

What is the best place to place the render call ???? of course i've worked with a simple loop and calling every frame. now im trying placing the render call at the WM_PAINT messages in the window callback (whats the thought about this???) And i should try more timers I guess. (any suggestions?) (I have multiple viewports, and possibly some loose render areas (preview windows e.g.). I need to update them all when editing in one etc, while there are some independant from the rest. (so I thougt the WM_PAINT would be a pefect place.. but not sure about all the details..) thanx

Share this post


Link to post
Share on other sites
Advertisement
The timer callback is a good place to post the redisplay if you want it to refresh every so often, and it works well most of the time, but you have to keep in mind that slower machines might not be able to render the scene every time the timer sequence comes up, so you might end up with some strange things happening.

I usually post the redisplay in the idle callback, and do any rotations/translations/etc. in the timer callback, so you know those things will all be done at the same time, and the machine is free to refresh whenever it has enough spare resources.

Share this post


Link to post
Share on other sites
If you call your rendering function (in case of double buffering, including a buffer swap) at every WM_PAINT message, you will be able to display something, but changing what is displayed will only be possible when the message is posted or when you call your rendering function somewhere else.
For as far as I know, WM_PAINT messages are posted when the window is moved, activated or resized (among other things). This is all well for static scenes, but not very useful for something more dynamic using, for instance, animations. In this case, the rendering function is commonly called as often as the monitor refresh rate, making it unnecessary to also call it for every WM_PAINT message.

If you use multiple viewports that you wish to update independently, you should look into using seperate device contexts and opengl contexts for their windows. Then you can switch between them using wglMakeCurrent and a call to SwapBuffers will only swap the buffers for one viewport.

Share this post


Link to post
Share on other sites
thanx
thats what im doin now, mulitple contexts and wglMakeCurrent.
But thats about it also right ?? not really more options left

Share this post


Link to post
Share on other sites
u might wanna see how some existing window managers do it for your OS
eg SDL, (theres a couple more which I cant name off the top of my head)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!