Friday, September 9, 2016

#JOGL Simple Program to draw a Triangle and rotate it about z-axis

Although the use of JPanel and calling repaint method on it is a good way to draw in Java Bindings for OpenGL I have followed the other method of creating a GLCanvas object and adding it to the JFrame object. In this program I have created a basic frame which sets the background color to red and clears the canvas and then draws a triangle. Each time the display is called by the FPSAnimator object the triangle is drawn at a new position after rotation by an angle. Angle is incremented in the display function itself.

Snapshot:

Here is the source in case you are interested to know.

No comments:

Post a Comment