Home » JOGL Coloring

JOGL Colors

In JOGL, a figure can be filled out with different type of colors. Coloring just enhances the look and feel of figure.

To specify the type of color, JOGL uses glColor3f() method of GL2 interface. This method follows RGB (Red, Green, Blue) color model. In this model, each color is represented with a value between 0 to 1 where 0 means none of that color and 1 means maximum of that color.

Note – It is required to pass the value of all three colors as a parameter of glColor3f() method.

JOGL Color Code List

Following is the list of codes for some frequently used colors :

Color Red Green Blue
Red 1 0 0
Green 0 1 0
Blue 1 1 0
Yellow 1 1 0
Orange 1 0.5 0
Purple 1 0 1
Cyan 0 1 1

JOGL single coloring Example

This is a simple example where a triangle is filled out with one (green) color only.



JOGL Colors Output

JOGL mixed Coloring Example

In this example, a triangle is filled out with three different colors.



JOGL Mixed Colors Output

Next TopicJOGL Rotation

You may also like