JOGL/OpenGL Example

Author: Ulf Dittmer

Date:3/14/2009

Description: These plugins demonstrate how JOGL graphics can be used in an ImageJ plugin. The first shows how to transfer an OpenGL image to an ImageJ image, while the second demonstrates the opposite. JOGL is an open source Java implementation of the OpenGL API, and can be downloaded here. That site also has introductory articles and demos.

Because JOGL graphics and their pixels live outside of the realm of normal Java operations, they can only be accessed through the JOGL API, not through standard Java API calls. JOGL also doesn't work well in multi-threaded environments, meaning its objects should only ever be accessed from a single thread.

The plugin is compatible with the JSR-231 JOGL release.

It has been tested on Mac OS X only; I'd be interested to hear about experiences on other operating systems.

Installation: You can download the source files OpenGLExample1_.java and OpenGLExample2_.java, and compile it using the "Compile and Run" command, or download the class files OpenGLExample1_.class, OpenGLExample1_$1.class, OpenGLExample2_.class and OpenGLExample2_$1.class and put them into the plugins folder. After restarting ImageJ, they should show up in the plugins menu.

JOGL needs to be installed, and the jogl.jar file must be in ImageJ's classpath.

Changes: November 2005
  • Initial version for JOGL 1.1.1
March 2006
  • Updated for the JSR-231 API
  • added second plugin demonstrating how to copy an ImageJ image to an OpenGL image
March 2009
  • OpenGLExample2 now checks that it has an RGB image to work with (instead of throwing an exception).

Back To ImageJ Plugin Page | Back To Home Page