Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Offscreen GL Rendering(How to render a GL item to offscreen image)
Offscreen GL Rendering [message #765323] Tue, 13 December 2011 15:48 Go to next message
Thomas Fletcher is currently offline Thomas Fletcher
Messages: 6
Registered: July 2009
Junior Member

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 ...)

captureImage(canvas)

canvas.dispose();

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.

Thanks,
Thomas
Re: Offscreen GL Rendering [message #765908 is a reply to message #765323] Wed, 14 December 2011 16:49 Go to previous message
jeff is currently offline jeff
Messages: 1
Registered: December 2011
Junior Member
I use GL's Framebuffer objects to render offscreen, then read the pixels from the offscreen framebuffer, and write to an image file using Java Advanced Imaging API. For your problem, you can create an Image directly from the framebuffer pixels.
Previous Topic:ScroolBar and Group
Next Topic:Paint over any control without interrupting dnd
Goto Forum:
  


Current Time: Thu Jul 31 17:38:39 EDT 2014

Powered by FUDForum. Page generated in 0.02326 seconds