light

light — Controls the use of lights in the rendering window.

Functions

Object Hierarchy

    GBoxed
    ├── VisuGlLight
    ╰── VisuGlLights

Description

One can defines several lights in OpenGL. The VisuGlLights is an object that stores several of them and that can be applied to the current OpenGL context using visu_gl_lights_apply(). The lights that are created with visu_gl_light_newDefault() are ambiant light with a white colour. The multiplier coefficient is use to soften lights when several are used together. It is used as a factor for all light parameters (ambient, diffuse...) ecept the specular one.

Functions

visu_gl_lights_new ()

VisuGlLights *
visu_gl_lights_new ();

Create a new VisuGlLights object. It contains no light when created. Use visu_gl_lights_add() to add new lights and visu_gl_lights_remove() to remove others.

Returns

a newly created VisuGlLights. Use visu_gl_lights_free() to free such an object.


visu_gl_lights_ref ()

VisuGlLights *
visu_gl_lights_ref (VisuGlLights *env);

Increase the ref counter.

Parameters

env

a VisuGlLights object.

 

Returns

itself.

Since: 3.7


visu_gl_lights_unref ()

void
visu_gl_lights_unref (VisuGlLights *env);

Decrease the ref counter, free all memory if counter reachs zero.

Parameters

env

a VisuGlLights object.

 

Since: 3.7


visu_gl_lights_free ()

void
visu_gl_lights_free (VisuGlLights *env);

Free memory occupied by the given environnement.

Parameters

env

a VisuGlLights object.

 

visu_gl_lights_available ()

gboolean
visu_gl_lights_available (VisuGlLights *env);

Inquire if one can add more lights to the scene.

Parameters

env

a VisuGlLights object.

 

Returns

TRUE if the maximum number of lights allowed by OpenGL implementation is not reached yet.

Since: 3.8


visu_gl_lights_add ()

gboolean
visu_gl_lights_add (VisuGlLights *env,
                    VisuGlLight *light);

This method adds the given light to the list of known lights declared in the given environnement. The light is not copied and should not be freed when stored in the environnement.

Parameters

env

a VisuGlLights object ;

 

light

a VisuGlLight object.

 

Returns

TRUE if visu_gl_lights_apply() should be called.


visu_gl_lights_remove ()

gboolean
visu_gl_lights_remove (VisuGlLights *env,
                       VisuGlLight *light);

This method removes the given light from the list of known lights declared in the given environnement. The light argument is first removed and then freed by a call to g_free().

Parameters

env

a VisuGlLights object ;

 

light

a VisuGlLight object.

 

Returns

TRUE if visu_gl_lights_apply() should be called.


visu_gl_lights_getList ()

GList *
visu_gl_lights_getList (VisuGlLights *env);

Retrieve the list of known VisuGlLight used by the given environnement.

Parameters

env

a VisuGlLights object.

 

Returns

a list of VisuGlLight objects. Should not be freed.

[transfer none][element-type VisuGlLight*]


visu_gl_lights_removeAll ()

gboolean
visu_gl_lights_removeAll (VisuGlLights *env);

Empty the list of stored lights. All stored lights objects are freed.

Parameters

env

a VisuGlLights object.

 

Returns

TRUE if the visu_gl_lights_apply() should be called.


visu_gl_lights_apply ()

gboolean
visu_gl_lights_apply (VisuGlLights *env);

Apply all stored informations about lights to the current OpenGL context.

Parameters

env

a VisuGlLights object.

 

Returns

TRUE if OpenGL context has been changed.


visu_gl_light_newDefault ()

VisuGlLight *
visu_gl_light_newDefault ();

Create a new light with default value (white color and position in the front, right, top position of the screen).

Returns

the newly created VisuGlLight. Use g_free() to deallocate this light.

Types and Values