Draw directly to ByteBuffer without updating the screen

Started by bcoopers, March 16, 2012, 23:39:49

Previous topic - Next topic

bcoopers

Hi, working on a project, and I need to draw some textured polygons to save to ByteBuffers without drawing them on the screen.  This will need to be done multiple times at the same time.  Right now I am doing it by clearing the color buffer, drawing my stuff on the screen, updating the display (doesn't work if I don't update the display), copying it with ReadPixels, and starting the process over by clearing the screen, repeating until all my buffers are drawn.  This, of course, causes periods of annoying flickering, which I would like to get rid of.  Any workarounds you guys know of?  It'd be nice to bind OpenGL to an imaginary graphics device that doesn't display to the scren and just copy from that, or somehow draw directly into the ByteBuffer, but any solution which would get rid of this annoying flickering would be great.  Any suggestions? Thanks!

spasi

The modern way is using framebuffer objects. If you need to target really old hardware/drivers, another option is pbuffers and render-to-texture (see org.lwjgl.opengl.Pbuffer and org.lwjgl.test.opengl.pbuffers.PbufferTest for example usage).