opengl speed up


i want to write an editor with opengl as renderer. To speed rendering up, i want render the not selected objects into a buffer to clear the window with this
buffer. Only the selected objects are rendered every time i modify them after clearing the window with the buffer.

I tried this with glReadPixels() and glDrawPixels(), but this was very slow. Is there any other method to solve this problem? How 3D Studio solves this?

Thanks in advance


You have to make sure you also properly
restore the Z buffer if you do this, else
the selection may draw “on top” even if it
is “behind” other stuff.

It may be easier and better to just render
the entire scene when you need to. I beleive
that’s what most editors do. After all, if
Quake can get 100 frames per second for
reasonably complex scenes, there’s no real
reason why you can’t, either, making updates
quite fast enough.

>>How 3D Studio solves this?<<

Kinetix (at that time) “created” this extension named GL_KTX_buffer_region for this purpose.
It’s ill defined but a de facto standard. (IMO an ISV should not define OpenGL extensions, let the IHVs do that. It didn’t even make it onto
Look for the WGL_ARB_buffer_region which should be defined a little cleaner.

If you don’t have this extension in your OpenGL implementation, you might look at the GL state which was active during glReadPixels and glDrawPixels. Disable everything which could prohibit a simple copy operation.
Another way would be to keep the backbuffer as backing storage, restore the image with glCopyPixels and render the modified object into the frontbuffer with depth-writes disabled. The object will flicker, but it’s modified anyway.

Another completely different approach is to use an overlay plane to draw a manipulation gizmo or wireframe view of the selected object. But this needs a board with overlay plane support.

[This message has been edited by Relic (edited 01-03-2001).]

The back buffer is not a safe backing store when the window is obscured.

If your driver uses unified back/depth buffers, which all workstation OpenGL vendors do, then obscured regions have undefined contents.

  • Matt

Most of the workstation OpenGL cards have an option to force buffer blit.

>>Most of the workstation OpenGL cards have an option to force buffer blit.<<

This is to control the export of PFD_SWAP_COPY and PFD_SWAP_EXCHANGE pixelformats.
Nonetheless OpenGL buffer contents are not defined for non-exposed Window areas (e.g. see the specs on glReadPixels).
You have to redraw things on WM_PAINT events before copying areas from buffer to buffer!