Skip to main content

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 20:48 Go to next message
Thomas Fletcher is currently offline Thomas FletcherFriend
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 ...)



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.

Re: Offscreen GL Rendering [message #765908 is a reply to message #765323] Wed, 14 December 2011 21:49 Go to previous message
jeff is currently offline jeffFriend
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 May 24 10:29:25 GMT 2018

Powered by FUDForum. Page generated in 0.02733 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top