VisuGl

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

Functions

Properties

gboolean antialias Read / Write
gboolean immediate Read / Write
VisuGlLights * lights Read
guint mode Read / Write
gboolean stereo Read / Write
gfloat stereo-angle Read / Write
gboolean true-transparency Read / Write

Types and Values

#define VISU_GL_OFFSCREEN
struct VisuGl
struct VisuGlClass

Object Hierarchy

    GObject
    ╰── ToolDbgObj
        ╰── VisuGl
            ╰── VisuGlExtSet

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

Functions

visu_gl_setColor ()

void
visu_gl_setColor (VisuGl *gl,
                  const float *material,
                  const float *rgba);

This method call glMaterial to create the right shiningness, emission, diffuse...

Parameters

gl

a VisuGl object.

 

material

a 5 elements array with the material properties ;

 

rgba

a 4 elements array with the color values.

 

visu_gl_setHighlightColor ()

void
visu_gl_setHighlightColor (VisuGl *gl,
                           const float material[5],
                           const float rgb[3],
                           float alpha);

This method try to set a colour that will contrast with rgb .

Parameters

gl

a VisuGl object.

 

material

a 5 elements array with the material properties ;

 

rgb

a 3 elements array with the color values.

 

alpha

the alpha channel.

 

visu_gl_getLights ()

VisuGlLights *
visu_gl_getLights (VisuGl *gl);

V_Sim proposes a wrapper around the OpenGL light definitions.

Parameters

gl

a VisuGl object.

 

Returns

the set of current lights.


visu_gl_applyLights ()

void
visu_gl_applyLights (VisuGl *gl);

If gl has some defined lights, it setup the OpenGL context with them and notify the "lights" parameter.

Parameters

gl

a VisuGl object.

 

Since: 3.8


visu_gl_setAntialias ()

gboolean
visu_gl_setAntialias (VisuGl *gl,
                      gboolean value);

To set the antialiasing on lines.

Parameters

gl

a VisuGl object.

 

value

a boolean to activate or not the lines antialias.

 

Returns

TRUE if value is actually changed.


visu_gl_getAntialias ()

gboolean
visu_gl_getAntialias (const VisuGl *gl);

Get the value of the antialiasing parameter.

Parameters

gl

a VisuGl object.

 

Returns

wether or not the antialising for lines is activated.


visu_gl_setImmediate ()

gboolean
visu_gl_setImmediate (VisuGl *gl,
                      gboolean value);

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

Parameters

gl

a VisuGl object.

 

value

a boolean to set or not the immediateDrawing option.

 

Returns

TRUE if the value is changed.


visu_gl_getImmediate ()

gboolean
visu_gl_getImmediate (const VisuGl *gl);

Get the value of the immediateDrawing option.

Parameters

gl

a VisuGl object.

 

Returns

the value of the immediateDrawing option.


visu_gl_setTrueTransparency ()

gboolean
visu_gl_setTrueTransparency (VisuGl *gl,
                             gboolean status);

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

Parameters

gl

a VisuGl object.

 

status

a boolean.

 

Returns

TRUE if redraw should be done.


visu_gl_getTrueTransparency ()

gboolean
visu_gl_getTrueTransparency (const VisuGl *gl);

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

Parameters

gl

a VisuGl object.

 

Returns

TRUE if the drawing is done twice.


visu_gl_getStereoCapability ()

gboolean
visu_gl_getStereoCapability (const VisuGl *gl);

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

Parameters

gl

a VisuGl object.

 

Returns

TRUE if the OpenGL surface can draw in stereo.


visu_gl_setStereo ()

gboolean
visu_gl_setStereo (VisuGl *gl,
                   gboolean status);

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

Parameters

gl

a VisuGl object.

 

status

a boolean.

 

visu_gl_getStereo ()

gboolean
visu_gl_getStereo (const VisuGl *gl);

Retrieve the status of the OpenGL surface.

Parameters

gl

a VisuGl object.

 

Returns

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


visu_gl_setStereoAngle ()

gboolean
visu_gl_setStereoAngle (VisuGl *gl,
                        float angle);

Change the angle of the eyes in the stereo output.

Parameters

gl

a VisuGl object.

 

angle

a positive floating point value.

 

Returns

TRUE if redraw should be done.


visu_gl_getStereoAngle ()

float
visu_gl_getStereoAngle (const VisuGl *gl);

Retrieve the angle of the eyes in the stereo output.

Parameters

gl

a VisuGl object.

 

Returns

the angle.


visu_gl_setMode ()

gboolean
visu_gl_setMode (VisuGl *gl,
                 VisuGlRenderingMode value);

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

Parameters

gl

a VisuGl object.

 

value

an integer to represent the method of rendering.

 

Returns

TRUE if value is actually changed.


visu_gl_getMode ()

VisuGlRenderingMode
visu_gl_getMode (const VisuGl *gl);

This function retrieve the value of the parameter renderingOption.

Parameters

gl

a VisuGl object.

 

Returns

the identifier of the current rendering option.


visu_gl_addHint ()

guint
visu_gl_addHint (VisuGl *gl,
                 guint value);

Set some additional hints to gl .

Parameters

gl

a VisuGl object.

 

value

a mask of hints.

 

Returns

the mask of current hints.

Since: 3.8


visu_gl_getHint ()

guint
visu_gl_getHint (VisuGl *gl);

Retrieve hints of gl .

Parameters

gl

a VisuGl object.

 

Returns

the mask of current hints.

Since: 3.8


visu_gl_initContext ()

void
visu_gl_initContext (VisuGl *gl);

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.

Parameters

gl

a VisuGl object.

 

Types and Values

VISU_GL_OFFSCREEN

#define VISU_GL_OFFSCREEN 1 << 0

An hint mentioning that the OpenGL context is used for offscreen rendering.

Since: 3.8


struct VisuGl

struct VisuGl;

Common name to refer to a _VisuGl.


struct VisuGlClass

struct VisuGlClass {
  VisuObjectClass parent;

  void (*initContext)(VisuGl* self);
};

Common name to refer to a _VisuGlClass.

Members

VisuObjectClass parent;

private.

 

initContext ()

called when used in a new OpenGL context.

 

Property Details

The “antialias” property

  “antialias”                gboolean

antialias line.

Flags: Read / Write

Default value: FALSE


The “immediate” property

  “immediate”                gboolean

immediate redraw after change.

Flags: Read / Write

Default value: TRUE


The “lights” property

  “lights”                   VisuGlLights *

light environment.

Flags: Read


The “mode” property

  “mode”                     guint

global rendering mode.

Flags: Read / Write

Allowed values: <= 3

Default value: 2


The “stereo” property

  “stereo”                   gboolean

differenciate right and left buffer.

Flags: Read / Write

Default value: FALSE


The “stereo-angle” property

  “stereo-angle”             gfloat

angle between left and right buffers.

Flags: Read / Write

Allowed values: [-45,45]

Default value: 5


The “true-transparency” property

  “true-transparency”        gboolean

draw in two passes to improve transparency.

Flags: Read / Write

Default value: FALSE