
Rubberband drawing and static backbuffer
Posted Monday, 30 June, 2008 - 11:27 by robpson in1) I'm creating a CAD like application. A single scene rendering might contains hundreds of thousands of lines and cannot be drawn in realtime when the paint event occurs. What I want to do is rendering to a static buffer, which I can blit/swap to the front buffer when a paint event occurs. The problem with SwapBuffers is that it seems to destroy the contents of the backbuffer, even in windowed mode. What is the best way to work this out?
2) I need some nice xor:ed rubberboxes (for object selection etc.). I can do this by setting GL.DrawBuffer to frontbuffer and GL.LogicOp to xor. However xor mode seems to work only in indexed color mode. Indexed color mode should be ok for me, if it wasnt for that hardware acceleration does not work if color depth is another than the physical screens. This makes indexed mode very slow. Any suggestions on how to use OpenGL to draw nice rubberlines/boxes using opengl?
/Rob.P.


Comments
Re: Rubberband drawing and static backbuffer
I have a similar issue with a GUI app I am writing. For performance reasons, I don't want to recreate every "window" each time I draw a frame.
To speed things up, I render each "window" in my GUI app to a Framebuffer. Then when I render to the screen, I can access the texture of the frame buffer and use that to texture a quad. I use alpha transparency to deal with non-rectangular windows. The performance improvement is quite impressive as long as your not re-rendering the framebuffer's texture each frame.
Here is some code I use to create / manage my framebuffer. This should give you a decent idea what to read in the OpenGL spec to get more info.