Javatpoint Logo
Javatpoint Logo

JOGL Interfaces

To create a JOGL program, it is required to understand the following interfaces: -

  • GLEventListener interface
  • GLAutodrawable interface

JOGL GLEventListener Interface

GLEventListener interface is present in javax.media.opengl package. It provides an event based mechanism that performs OpenGL rendering. To inherit the functionality of graphics in a program, it is required to implement this interface.

GLEventListener Methods

These are the four important methods of GLEventListner interface. It is mandatory to override all these methods.

Method Description
void display(GLAutoDrawable drawable) It is called by GLAutoDrawable object to initiate OpenGL rendering by the client.
void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) It is called by GLAutoDrawable object when the display mode or device associate with it has changed.
void init(GLAutoDrawable drawable) It is called by GLAutoDrawable object immediately after the OpenGL context is initialized.
void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) It is called by GLAutoDrawable object during the first repaint.

JOGL GLAutoDrawable Interface

GLEventListener interface is present in javax.media.opengl package. The purpose of this interface is to provide an event based mechanism (GLEventListener) to generate an image.

GLAutoDrawable Methods

Following are the frequently used GLAutoDrawable methods: -

Method Description
void addGLEventListener(GLEventListener listener) It adds the object of GLEventListener to the end of drawable queue.
GLContext getContext() It returns the context associated with drawable.
void destroy() It removes all the resources associated with GLAutoDrawable.
boolean isThreadCapable() It specifies whether The current thread is capable of performing OpenGL related work

Next TopicJOGL Classes





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA