124
JOGL Transform Functions
JOGL transformation is a mechanism that provides special effect to graphical objects. These effects are applied after the creation of an image. Following are the frequently used transformation functions: –
glLoadIdentity()
- The glLoadIdentity() method replaces the current transformation matrix with the identity matrix
- It can reset the current transformation matrix before performing a transformation.
glTranslate()
- The glTranslate() method multiplies the current matrix by a translation matrix.
- To translate an object the following syntax is used: –
Here,
x,y,z – The x, y, z represents as a coordinate of translation vector.
glPushMatrix()
- The glPushMatrix() pushes the current matrix stack down by one.
- After the invoking of glPushMatrix() method, the matrix on top of the stack is similar to its below one.
glPopMatrix()
- The glPopMatrix() pop the current matrix stack.
- To pop current matrix, it replaces the current matrix with the one below it on the stack.
glOrtho() method
- The glOrtho() method multiply the current matrix into orthographic matrix.
- It produces the parallel projection of an image in 3D space.
- Syntax:-
Here,
l, r – It specify the left and right vertical clipping planes coordinates.
b, t – It specify the bottom and top horizontal clipping planes coordinates.
nearVal, farVal – It specify the distance to the near and farther depth clipping plane.
glViewport()
- The glViewport() method is used to set the view of an image that represents the visible area of display.
- The following syntax is used to set the view: –
Here,
x, y – Specifies the lower left corner of the viewport rectangle.
w, h – Specifies the width and height of the port.
Now, we will learn some important transformation functions in detail.
Next TopicJOGL Scaling