## opengl

opengl — This part is responsible for the pseudo3D rendering through OpenGl and gives methods to adapt the view.

## Synopsis

    void                openGL_reDraw                       (const char **lists,
                                                             VisuData *data);
    void                openGL_drawToEmpty                  (const char **lists,
                                                             VisuData *data);

    int                 setAntialias                        (int value);
    int                 getAntialias                        ();
    gboolean            openGLGet_trueTransparency          ();
    gboolean            openGLSet_trueTransparency          (gboolean status);
    const char**        openGLGet_allRenderingModesI18n     ();
    int                 openGLGet_immediate                 ();
    gboolean            openGLGet_stereo                    ();
    float               openGLGet_stereoAngle               ();
    gboolean            openGLGet_stereoCapability          ();
    LightEnvironnement* openGLGet_currentLights             ();
    void                openGLSet_immediate                 (int bool);
    void                openGLSet_stereo                    (gboolean status);
    gboolean            openGLSet_stereoAngle               (float angle);
    void                openGLInit_context                  ();

    int                 initOpengl                          ();

## Description

There is a last parameter which controls when render is done. There are two states : whenever a changing occurs (in fact when the OpenGLAskForReDraw signal is received) or only the OpenGLForceReDraw is received.

Except when high performances are required, this module never makes a redraw by itself, even when parameters such as the camera position are changed. The redraw must be asked by the client by emitting the OpenGLAskForReDraw signal or the OpenGLForceReDraw signal. This is to avoid situations when the client makes different changes but want just only one redraw at the end. All set methods return a boolean which informs the client of the opportunity to redraw after the set occurs. For example, if the client call a set change on theta or phi but the server returns FALSE, it means that not emission of OpenGLAskForReDraw is needed (for example because theta or phi had already these values).

## Details

### openGL_reDraw ()

    void                openGL_reDraw                       (const char **lists,
                                                             VisuData *data);

Basic drawing method : it clears the OpenGL area and call all lists if `lists` is NULL, or draw only the given lists.

`lists` : | a string array, NULL terminated.
`data` : | the VisuData to redraw.

### openGL_drawToEmpty ()

    void                openGL_drawToEmpty                  (const char **lists,
                                                             VisuData *data);

Basic drawing method when no data is loaded: it draws the V_Sim logo.

`lists` : | always NULL.
`data` : | always NULL.

### setAntialias ()

    int                 setAntialias                        (int value);

To set the antialiasing on lines.

`value` : | a boolean to activate or not the lines antialias.
Returns : | TRUE if the signal OpenGLAskForReDraw should be emitted.

### getAntialias ()

    int                 getAntialias                        ();

Get the value of the antialiasing parameter.

Returns : | wether or not the antialising for lines is activated.

### openGLGet_trueTransparency ()

    gboolean            openGLGet_trueTransparency          ();

The drawing can be done in one pass or two to respect transparency.

Returns : | TRUE if the drawing is done twice.

### openGLSet_trueTransparency ()

    gboolean            openGLSet_trueTransparency          (gboolean status);

If true the rendering is done twice to respect the transparency.

`status` : | a boolean.
Returns : | TRUE if redraw should be done.

### openGLGet_allRenderingModesI18n ()

    const char**        openGLGet_allRenderingModesI18n     ();

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).

### openGLGet_immediate ()

    int                 openGLGet_immediate                 ();

Get the value of the immediateDrawing option.

Returns : | the value of the immediateDrawing option.

### openGLGet_stereo ()

    gboolean            openGLGet_stereo                    ();

Retrieve the status of the OpenGL surface.

Returns : | TRUE if the surface try to draw in stereo (may be TRUE, even if `openGLGet_stereoCapability()` returns FALSE, in that case the stereo capability is not used).

### openGLGet_stereoAngle ()

    float               openGLGet_stereoAngle               ();

Retrieve the angle of the eyes in the stereo output.

Returns : | the angle.

### openGLGet_stereoCapability ()

    gboolean            openGLGet_stereoCapability          ();

Retrieve if the OpenGL window can render in stereo or not.

Returns : | TRUE if the OpenGL surface can draw in stereo.

### openGLGet_currentLights ()

    LightEnvironnement* openGLGet_currentLights             ();

### openGLSet_immediate ()

    void                openGLSet_immediate                 (int bool);

If true all changes are applied only when the refresh button is pushed.

`bool` : | a boolean to set or not the immediateDrawing option.

### openGLSet_stereo ()

    void                openGLSet_stereo                    (gboolean status);

Change the type of rendering. The surface can be switch to stereo, only if the OpenGL has stereo capabilities (see `openGLGet_stereoCapability()`).

`status` : | a boolean.

### openGLSet_stereoAngle ()

    gboolean            openGLSet_stereoAngle               (float angle);

Change the angle of the eyes in the stereo output.

`angle` : | a positive floating point value.
Returns : | TRUE if redraw should be done.

### openGLInit_context ()

    void                openGLInit_context                  ();

This method is called when an OpenGL surface is created for the first time. It sets basic OpenGL options and calls other OpenGLFunctions used in V_Sim.

### initOpengl ()

    int                 initOpengl                          ();

This initialises the drawing window and all the variables used by this module. It must be called once by the main program and should not be used otherwise.

Returns : | 1 if everything goes right.