Using OpenGL in SWT Applications

Java OpenGL Bindings (SWT 3.2 and newer)

Support for OpenGL is included in SWT as of Eclipse 3.2 in the package org.eclipse.swt.opengl. See the GLCanvas class for a widget which hosts an OpenGL context.

OpenGL applications use two separate APIs: the window-system independent drawing API (OpenGL), and a window-system specific integration layer (WGL under Windows, GLX under X, etc). SWT provides a thin layer above the window-system specific integration API, enabling applications to use their Java OpenGL binding of choice.

  1. The Lightweight Java Game Library (LWJGL) is a Java binding for OpenGL which supports OpenGL 2.0 and many interesting extensions. For an example using LWJGL with SWT, see Snippet 195.

  2. JOGL is a Java binding for OpenGL. For an example using JOGL with SWT, see Snippet 209.

  3. gljava is a Java binding for OpenGL which aims to be simple and thin. gljava is reported to work well with SWT.

The Experimental org.eclipse.opengl Binding (pre-SWT 3.2)

Prior to Eclipse 3.2 there were experimental packages (available below) that facilitated the use of OpenGL in SWT. To run the OpenGL view example, simply extract the zip and the org.eclipse.opengl plugin to your Eclipse plugins folder. To run the standalone example, download the examples zip along with the org.eclipse.opengl zip for your platform and import them into your workspace. There is also a stand-alone snippet that uses this package (Snippet 174).

If you are using SWT 3.2 or newer then you should use the supported OpenGL binding that is included in the SWT package instead of these experimental downloads which are not supported.

  Deprecated OpenGL Binding for SWT (Experimental)
28 Sep 2005 Windows eclipse-opengl-0.5.0-win32.zip
28 Sep 2005 Linux x86 eclipse-opengl-0.5.0-linux-x86.zip
28 Sep 2005 MacOS X eclipse-opengl-0.5.0-macosx.zip
28 Sep 2005 Example applications org.eclipse.swt.opengl.examples_0.5.0.zip
28 Sep 2005 Example plugin with a view that uses OpenGL org.eclipse.swt.examples.openglview_0.5.0.zip
 
  Deprecated OpenGL Binding for SWT 3.1
10 Nov 2004 Experimental OpenGL plugins for SWT 3.1 old implementation