101
JOGL Rotation
In JOGL, an object can be rotated in any direction along any of the three axis. To rotate an object you need to follow the below step: –
- Removes the previous state of an object to clear the view. For that you need to clear the color and depth buffer by using the following method: –
- Now, reset the project matrix with the help of glLoadIntensity() method
- Invoke the glRotatef() method of GLMatrixFunc interface.
Frame per Second Animator Class
The FPSAnimator class is a subclass of Animator class used to rotate an object at the rate of frame per second.
Constructor of FPSAnimator Class
Constructor | Description |
---|---|
FPSAnimator(int fps) | It creates an FPSAnimator with specified value of target frame-per-second. |
FPSAnimator(GLAutoDrawabledrawable, int fps) | It creates an FPSAnimator with an intialdrawable to animate and specified value of target frame-per-second. |
FPSAnimator(GLAutoDrawabledrawable, int fps, booleanscheduleAtFixedRate) | It creates an FPSAnimator with an intialdrawable to animate, specified value of target frame-per-second and a flag that specifies whether to use fixed-rate scheduling. |
FPSAnimator(int fps, booleanscheduleAtFixedRate) | It creates an FPSAnimator with specified value of target frame-per-second a flag that specifies whether to use fixed-rate scheduling. |
JOGL Rotation Example
In this example, we will rotate a triangle.
Output:
Next TopicJOGL Lightning