Javatpoint Logo
Javatpoint Logo

JOGL Lightning

Using JOGL, you can provide various light effects to any type of object through coding. This effects makes the object visually better.

Lighting Source

Following are some of the important light sources: -

  • Ambient Lightning - It always give a particular color to an object.
  • Diffuse Lightning - It scattered the light on an object from different angles.
  • Specular Lightning - It simulates the bright spot of light on an object

JOGL Important Methods

These are some of the important methods used to provide light to an object: -

  • glEnable() - Invoke this method to enable the light property for an object with the required argument as shown below :
  • glDisable() - This method disables the light. By default, the property is disabled.
  • glLightFV() - This is a method of GLLightingfunc interface and contains four light source parameters. These parameters are: -
    • Light - It specifies a type of light.
    • Pname - It specifies a source of light parameter.
    • Param - This is used to specify the value passed in pname parameters.
    • Source parameter - Pass the required light source parameter.

JOGL Lighting Example

In this example, we will rotate a triangle as we have done earlier. With each rotation you will notice that the color of triangle will also be changed.


JOGL Lightning
Next TopicJOGL 3D Objects

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA