Home » JOGL Primitives Shapes

JOGL Primitives Shapes

by Online Tutorials Library

JOGL Primitive Shapes

In the previous examples, we have already learnt that in JOGL any type of shape can be drawn with the help of GL_LINES parameter. But apart from that, JOGL also contains various other parameters through which we can draw the particular shape such as triangle, quadrilateral, polygon etc. directly (i.e. in the simpler way).

JOGL Primitive Triangle Example

In this example, we will see how to create a triangle with the help of primitive triangle parameter (GL_TRIANGLES).

Triangle.java

Output:

JOGL Primitive Shapes Triangle Output

JOGL Primitive Quadrilateral Example

In this example, we will see how to create a quadrilateral with the help of primitive quadrilateral parameter (GL_QUADS).

JQuad.java

Output:

JOGL Primitive Shapes Quadrilateral Output

You may also like