Rendering a Scene

Is there a wy to render a scene only once instead of continuously re-rendering it in a display function?

thanks
Jess

Hi,

Are u using MFC to create the scene?
If yes, put SendMessage(WM_PAINT); in OnTimer(). It will solved your problem. A simple MFC examples can be found in http://myopendemo.hypermart.net/MFC.htm.

Try to put glutPostRedisplay() in idle() if u r using console appllication.

Hope it can help. Thanks.

If you mean that your data is static and or takes lots of time to render, then (very easy and dirty way) you can read the image with glReadPixels into a ram buffer and on the WM_PAINT/display call just draw the ram buffer with glDrawPixels, remember to recreate it if the window changes size though.

Mikael

Originally posted by mikael_aronsson:
[b]If you mean that your data is static and or takes lots of time to render, then (very easy and dirty way) you can read the image with glReadPixels into a ram buffer and on the WM_PAINT/display call just draw the ram buffer with glDrawPixels, remember to recreate it if the window changes size though.

Mikael[/b]

It is pretty easy it will take more than just re-rendering everything. I was forced to do this some time ago and I got less than .5fps at 800x600.

Hiding the WM_PAINT messages looks much better - I raccomand that method.

A faster way to do what you suggested is to use WGL_ARB_buffer_region but the WM_PAINT way works much better and there’s a bug in nv drivers (should have been corrected right now but I cannot be sure - never tested the app again) which causes this extension to just crash in some circustances.