|Offscreen GL Rendering [message #765323]
||Tue, 13 December 2011 20:48
| Thomas Fletcher
Registered: July 2009
I would like to use the GL support in Eclipse to render to a specific area within my GEF application. In order to do this, I need to transform the GL content into an Image and then I can composite it into the GEF figure.
I looked at the SWT snippets and while they work for rendering content into an SWT widget (GLCanvas). There is also a snippet for capturing the canvas content into an image, but that doesn't seem to work properly if you 'inline' the code so that it does (in short form):
GLCanvas canvas = new GLCanvas(..)
... set drawing in the canvas ...
display.syncExec( ... force a draw ...)
I never get any meaningful content on my image. The key problem it seems is that the GL rendering doesn't happen until the second or so call to draw/refresh. I thought that I could add in some GLflush() calls and/or some canvas.swapBuffer() calls but that had no effect.
I can post a full sample if that helps ... alternatively if there is an easier way to do this, then I'd love to hear about it. I'm just starting to wade into the GL world and there is lots in the API to learn.
Powered by FUDForum
. Page generated in 0.06671 seconds