LWJGL Forum

Programming => General Java Game Development => Topic started by: jonkri on October 09, 2008, 02:28:29

Title: Using LWJGL with SWT canvas
Post by: jonkri on October 09, 2008, 02:28:29
Hello everyone!

I'm using the OGRE 3D engine through ogre4j to draw on a SWT canvas. The possibility to draw on an AWT canvas is not currently available in ogre4j. Anyway, in order for me to use LWJGL I need to wrap my canvas into a LWJGL Display somehow. Is there a way to do this?

Thank you in advance!

Warm regards,
Jon Kristensen
Title: Re: Using LWJGL with SWT canvas
Post by: Matzon on October 09, 2008, 05:55:16
swt supports using lwjgl as a backend - there are some snippets on eclipse.org. LWJGL has the possibility to draw into any canvas using the Display.setParent() feature.
Title: Re: Using LWJGL with SWT canvas
Post by: jonkri on October 09, 2008, 16:21:27
Thank you for your reply. However, I don't quite understand.

The only snippet I could find was http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet275.java?view=co (http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet275.java?view=co), and it doesn't use a LWJGL Display. Also, how can I use Display.setParent() on anything other than an AWT canvas when the method is defined as setParent(java.awt.Canvas parent)?