Javatpoint Logo
Javatpoint Logo

JOGL Basic Frames

A Frame is a container that contains a title and a border. It can also contain various other components such as labels, buttons, checkbox etc.

Here, we will learn how to create a frame by using JOGL technology.

Following are the steps to create a frame: -

  • Create a new Java project in eclipse and add all the required jar files in it. We have already discussed about it in the previous section.
  • Create Java class and import the required packages.
  • Now, implement GLEventListener interface and override its following methods: -
    • void init(GLAutodrawableobj)
    • void display(GLAutodrawableobj)
    • void reshape(GLAutodrawableobj)
    • void dispose(GLAutodrawableobj)
  • Construct the object of GLProfile class and specify the exact version of OpenGL API.
  • Construct the class GLCapabilities and pass the object of GLProfile class with it.
  • Now, construct GLCanvas class and pass the object of GLCapabilities class with it.
  • Now, use the method addGLEventListener() to add GLEventListener with an object of GLCanvas class.
  • Set the size of canvas using setSize() method and pass the dimensions as parameter.

This is the basic structure used to create a frame. Now we will embed this part with the functionality of window tool kit.

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA