*91*

# 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.

### Syntax

gluPerspective(float fovy, float aspect, float zNear, float zFar)

**Here,**

**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.

Next TopicJOGL 3D Basic Shape