JOGL 3D Objects
JOGL 3D Objects with Introduction, Installation, Interfaces, Classes, Frame using AWT, Frame using Swing, 2D Objects, Primitives Shapes, 3D Cube, 3D Triangle, 3D Basic Shape, 3D Objects etc.
JOGL 3D Objects
In the previous section of tutorial, we already learn how to create 2D shapes and perform various operations on it. Apart from 2D, JOGL also provides hardware supported 3D graphics to applications.
JOGL 3D Important methods
- glMatrixMode() Method
The glMatrixMode() method is used to specify the current matrix. It contains a mode within its parameter that specify the target matrix stack for subsequent matrix operations. This mode can accepts any of the below values:
- GL_MODELVIEW - Used to apply subsequent matrix operations to the modelview matrix stack which defines the transformations (such as rotation, scaling, lightning) of an object.
- GL_PROJECTION - Used to apply subsequent matrix operations to the projection matrix stack that defines properties of the camera such as aspect ratio, zoom factor etc.
- GL_TEXTURE - Used to apply subsequent matrix operations to the texture matrix stack.
- GL_COLOR - Used to apply subsequent matrix operations to the color matrix stack.
- gluPerspective() Method
This method is used to represent three dimensional object on a two-dimensional surface correctly. To access this method create an object of class GLU. This class will provide access to OpenGL Utility Library. Associate this method with the object of GLU class.
gluPerspective(float fovy, float aspect, float zNear, float zFar)
- Favy - Defines the field of view angle.
- Aspect - Defines the aspect ratio that specify the field of view in the x-direction.
- zNear - Defines the distance between viewer and nearest clipping pane.
- zFar - Defines the distance between viewer and farest clipping pane.