renderingMode

renderingMode — Controls the way OpenGL renders objects.

Synopsis

enum                VisuGlRenderingMode;
void                visu_gl_rendering_applyMode         (VisuGlRenderingMode mode);
const char **       visu_gl_rendering_getAllModeLabels  (void);
const char **       visu_gl_rendering_getAllModes       (void);
VisuGlRenderingMode visu_gl_rendering_getGlobalMode     (void);
gboolean            visu_gl_rendering_getModeFromName   (const char *name,
                                                         VisuGlRenderingMode *id);
void                visu_gl_rendering_init              (void);
gboolean            visu_gl_rendering_setGlobalMode     (VisuGlRenderingMode value);

Description

This modules creates an interface to access to the way OpenGL renders the objects (glPolygonMode() and glToolShadeModel() functions). There are then three rendering modes available in V_Sim: wireframe, flat and smooth. They are controls by an enum RenderingModeId. When visu_gl_rendering_applyMode() is called, the current rendering mode is changed for all future drawing calls that uses polygons.

Details

enum VisuGlRenderingMode

typedef enum {
    VISU_GL_RENDERING_WIREFRAME,
    VISU_GL_RENDERING_FLAT,
    VISU_GL_RENDERING_SMOOTH,
    VISU_GL_RENDERING_SMOOTH_AND_EDGE,
    VISU_GL_RENDERING_N_MODES,
    VISU_GL_RENDERING_FOLLOW
} VisuGlRenderingMode;

Implemented mode to draw objects.

VISU_GL_RENDERING_WIREFRAME

objects are rendered with lines only ;

VISU_GL_RENDERING_FLAT

objects are rendered with polygons whose colours are uniform on each polygon ;

VISU_GL_RENDERING_SMOOTH

objects are rendered with polygons whose colours are shaded to be smooth all along the object.

VISU_GL_RENDERING_SMOOTH_AND_EDGE

objects are rendered with lines hightlighting the contours of polygons.

VISU_GL_RENDERING_N_MODES

number of rendering mode.

VISU_GL_RENDERING_FOLLOW

use this value not to choose any rendering mode.

visu_gl_rendering_applyMode ()

void                visu_gl_rendering_applyMode         (VisuGlRenderingMode mode);

Change the rendering mode of current OpenGL context.

mode :

an integer.

visu_gl_rendering_getAllModeLabels ()

const char **       visu_gl_rendering_getAllModeLabels  (void);

This function retrieve al the names (translated) of available rendering modes.

Returns :

an array of string, NULL terminated that is private (not to be freed). [transfer none]

visu_gl_rendering_getAllModes ()

const char **       visu_gl_rendering_getAllModes       (void);

This function retrieve al the names of available rendering modes.

Returns :

an array of string, NULL terminated that is private (not to be freed). [transfer none]

visu_gl_rendering_getGlobalMode ()

VisuGlRenderingMode visu_gl_rendering_getGlobalMode     (void);

This function retrieve the value of the parameter renderingOption.

Returns :

the identifier of the current rendering option.

visu_gl_rendering_getModeFromName ()

gboolean            visu_gl_rendering_getModeFromName   (const char *name,
                                                         VisuGlRenderingMode *id);

This function retrieve the rendering mode id associated to the name.

name :

a string ;

id :

a location to store the resulting id.

Returns :

TRUE if the name exists.

visu_gl_rendering_init ()

void                visu_gl_rendering_init              (void);

This method is used by opengl.c to initialise this module (declare config file options...). It should not be called elsewhere.


visu_gl_rendering_setGlobalMode ()

gboolean            visu_gl_rendering_setGlobalMode     (VisuGlRenderingMode value);

This function change the value of the parameter renderingOption. It controls how V_Sim renders objects, in wireframe for example.

value :

an integer to represent the method of rendering.

Returns :

TRUE if the signal OpenGLAskForReDraw should be emitted.