Skip to main content



      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
Eclipse UserFriend

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
Eclipse UserFriend
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: Tue Jul 01 16:45:06 EDT 2025

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

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

Back to the top