PDA

View Full Version : Rendering a Scene



jessica
11-03-2003, 07:49 PM
Is there a wy to render a scene only once instead of continuously re-rendering it in a display function?

thanks
Jess

cwc36
11-03-2003, 09:03 PM
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.

mikael_aronsson
11-04-2003, 03:34 AM
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

Obli
11-05-2003, 05:01 AM
Originally posted by mikael_aronsson:
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

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.