Please note, this is a STATIC archive of website www.javatpoint.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
Javatpoint Logo
Javatpoint Logo

JOGL Classes

In this section, we will learn about the classes provided by JOGL. Through these classes, we can add the functionality of OpenGL in Java code.

Following are the important classes provided by JOGL: -

  • GLCanvas Class
  • GLJPanel Class
  • GLProfile Class
  • GLCapabilities Class
  • GLCanvas and GLJPanel class are GUI classes that implements GLAutoDrawable interface and utilized as drawing surfaces for Open GL commands.

GLCanvas Class

  • GLCanvas class is a heavy-weight AWT component present in javax.media.opengl.awt package.
  • It extends the functionality of Canvas class and provides OpenGL rendering support.
  • Being an AWT component, GLCanvas is much compatible with AWT in comparison to Swing.
  • Due to hardware acceleration, it executes OpenGL operations rapidly.

GLCanvas Constructors

Constructor Description
GLCanvas() It creates a new GLCanvas component with default set of OpenGL capabilities by using the mechanism of default OpenGL capabilities on the default screen device.
GLCanvas(GLCapabilities cap) It creates a new GLCanvas component with requested set of OpenGL capabilities by using the mechanism of default OpenGL capabilities on the default screen device.

GLCanvas Methods

Method Description
void addGLEventListener(GLEventListener listener) It adds GLEventListener to this drawable.
void display() It causes OpenGL rendering for GLAutoDrawable interface.
void removeGLEventListener(GLEventListener listener) It removes GLEventListener to this drawable.

GLJPanel Class

  • GLCanvas class is a light-weight Swing component present in javax.media.opengl.awt package.
  • It extends JPanel interface and provide OpenGL rendering support.
  • It uses hardware-accelerated rendering through pbuffers. As pbuffer cannot be resized, sometimes problem may occurs during resize operations.

GLCanvas Constructor

Constructor Description
GLJPanel() It creates a new GLJPanel component with default set of OpenGL capabilities by using the mechanism of default OpenGL capabilities on the default screen device.
GLJPanel (GLCapabilities cap) It creates a new GLJPanel component with requested set of OpenGL capabilities by using the mechanism of default OpenGL capabilities on the default screen device.

GLCanvas Constructor

Method Description
void addGLEventListener(GLEventListener listener) It adds GLEventListener to this drawable.
void display() It causes OpenGL rendering for GLAutoDrawable interface.
void removeGLEventListener(GLEventListener listener) It removes GLEventListener to this drawable.

GLProfile Class

The OpenGL interfaces such as GL2, GL3, GL4 contains all the core method of a particular version. The role of GLProfile class is to specify the particular OpenGL interface on the basis of version required.

GLProfile Methods

Method Description
GLProfile get(String profile) It is used to return an object of GLProfile.
boolean isGL3() It is used to indicate whether profile is capable of GL2 or not.
boolean isGL3() It is used to indicate whether profile is capable of GL3 or not.

GLCapibilities Class

GLCapibilities class is used to specify the capabilities of OpenGL such as OpenGL profile, color depth etc. The object of GLProfile class is passed as a parameter to this class.

GLCapibilities Method

Method Description
GLProfilegetGLProfile() It is used to return the required GLProfile.
booleanisStereo() It is used to indicate whether stereo is enabled or disabled

Next TopicJOGL Basic Frames





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