VisuGlExt

VisuGlExt — All objects drawn by V_Sim are defined in by a VisuGlExt object

Functions

Properties

gboolean active Read / Write
gchar * description Read / Write
gboolean dirty Read / Write
gchar * label Read / Write / Construct
guint nGlObj Read / Write / Construct Only
gchar * name Read / Write / Construct Only
guint priority Read / Write
gboolean saveState Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── ToolDbgObj
        ╰── VisuGlExt
            ├── VisuGlExtAxes
            ├── VisuGlExtBg
            ├── VisuGlExtBox
            ├── VisuGlExtFrame
            ├── VisuGlExtNodeVectors
            ├── VisuGlExtInfos
            ├── VisuGlExtMaps
            ├── VisuGlExtMarks
            ├── VisuGlExtNodes
            ├── VisuGlExtPairs
            ├── VisuGlExtPaths
            ├── VisuGlExtPlanes
            ├── VisuGlExtScale
            ╰── VisuGlExtSurfaces

Description

All objects that are drawn by V_Sim are handled by a VisuGlExt object. Such an object has an OpenGL list. This list is only COMPILED. When V_Sim receives the 'OpenGLAskForReDraw' or the 'OpenGLForceReDraw' signals, each list of all known VisuGlExt are excecuted. This excecution can be canceled if the used flag of the VisuGlExt object is set to FALSE. The order in which the lists are called depends on the priority of the VisuGlExt object. This priority is set to VISU_GL_EXT_PRIORITY_NORMAL as default value, but it can be tune by a call to visu_gl_ext_setPriority(). This priority is an integer, the lower it is, the sooner the list is excecuted.

The method registerVisuGlExt() is used to declare to V_Sim that there is a new VisuGlExt object available. This allows to create extension when V_Sim is already running. Nevertheless, an extension must be initialized in the initialisation process, it is better to add an initVisuGlExtFunc method in the listInitExtensionFunc array declared in extensions/externalVisuGlExts.h.

Once again, the OpenGL list corresponding to an OpenGL extension is COMPILE only. Then, OpenGL methods like glIsenabled() are totally unusefull because it is called when the list is compiled not when the list is called. If the extension needs to alter some OpenGL state, such as desable GL_LIGHTING, it needs to set a flag for the extension. With this flag, V_Sim will save the OpenGL states and restore it when the list is called. Use visu_gl_ext_setSaveState() to set this flag.

Functions

visu_gl_ext_setDirty ()

gboolean
visu_gl_ext_setDirty (VisuGlExt *ext,
                      gboolean status);

Set an internal flag to mark that ext should be redrawn before next OpenGL frame view.

Parameters

ext

a VisuGlExt object.

 

status

a boolean.

 

Returns

TRUE is status is actually changed.

Since: 3.8


visu_gl_ext_setPriority ()

void
visu_gl_ext_setPriority (VisuGlExt *extension,
                         guint priority);

Extentions are drawn in an order that depends on their priority. The lower is the number, the sooner the extension is drawn. Flags, such as VISU_GL_EXT_PRIORITY_NORMAL or VISU_GL_EXT_PRIORITY_LOW, can be used or user defined values are also possible.

Parameters

extension

a VisuGlExt object ;

 

priority

an integer value.

 

visu_gl_ext_getPriority ()

guint
visu_gl_ext_getPriority (VisuGlExt *extension);

Inquire the priority of extension .

Parameters

extension

a VisuGlExt object.

 

Returns

the VisuGlExt priority.

Since: 3.8


visu_gl_ext_setSaveState ()

void
visu_gl_ext_setSaveState (VisuGlExt *extension,
                          gboolean saveState);

If the extension needs to change some OpenGL state (to disable the fog for example, or the cullface), a flag should be set to enable V_Sim to restore the right values after the extensio have been called. Because the OpenGL list of an extension is just GL_COMPILE the extension can't just save and restore state itself because when the list is called, the state can have been changed.

Parameters

extension

a VisuGlExt object ;

 

saveState

an boolean value.

 

visu_gl_ext_setSensitiveToRenderingMode ()

void
visu_gl_ext_setSensitiveToRenderingMode
                               (VisuGlExt *extension,
                                gboolean status);

If status is TRUE, when the extension is rendered, OpenGL context is switched to the rendering mode preferd for the extension. Use visu_gl_ext_setPreferedRenderingMode() to choose one.

Parameters

extension

a VisuGlExt object ;

 

status

an boolean value.

 

visu_gl_ext_getSensitiveToRenderingMode ()

gboolean
visu_gl_ext_getSensitiveToRenderingMode
                               (VisuGlExt *extension);

Each VisuGlExt method can follow or not the global setting for the rendering mode, see VisuGlRenderingMode. See also visu_gl_ext_setSensitiveToRenderingMode().

Parameters

extension

a VisuGlExt object.

 

Returns

TRUE if extension can change its rendering mode according to global settings.

Since: 3.7


visu_gl_ext_getActive ()

gboolean
visu_gl_ext_getActive (VisuGlExt *extension);

Get if the extension is used or not. If not its ObjectList is not rendered.

Parameters

extension

the extension.

 

Returns

TRUE if used, FALSE otherwise.


visu_gl_ext_setActive ()

gboolean
visu_gl_ext_setActive (VisuGlExt *extension,
                       gboolean value);

Set if an extension is actually used or not.

Parameters

extension

the extension,

 

value

the new value.

 

visu_gl_ext_getGlContext ()

VisuGl *
visu_gl_ext_getGlContext (VisuGlExt *extension);

The VisuGl object this extension draws to.

Parameters

extension

a VisuGlExt object.

 

Returns

the VisuGl object this extension draws to.

[transfer none][allow-none]

Since: 3.8


visu_gl_ext_setGlContext ()

gboolean
visu_gl_ext_setGlContext (VisuGlExt *extension,
                          VisuGl *gl);

Associate gl to extension .

Parameters

extension

a VisuGlExt object.

 

gl

a VisuGl object.

[transfer none]

Returns

TRUE if the value is actually changed.

Since: 3.8


visu_gl_ext_setPreferedRenderingMode ()

gboolean
visu_gl_ext_setPreferedRenderingMode (VisuGlExt *extension,
                                      VisuGlRenderingMode value);

This method is used to specify the rendering mode that the extension should use to be drawn (if the sensitive flag has been set, see visu_gl_ext_setSensitiveToRenderingMode()). If the value is set to VISU_GL_RENDERING_FOLLOW, the extension follows the global setting for rendering mode.

Parameters

extension

a VisuGlExt object ;

 

value

see VisuGlRenderingMode to choose one.

 

Returns

TRUE if value is actually changed.


visu_gl_ext_getPreferedRenderingMode ()

VisuGlRenderingMode
visu_gl_ext_getPreferedRenderingMode (VisuGlExt *extension);

Each VisuGlExt method can draw in a mode different from the global one, see VisuGlRenderingMode. See also visu_gl_ext_setPreferedRenderingMode().

Parameters

extension

a VisuGlExt method.

 

Returns

the prefered rendering mode of this extension .

Since: 3.7


visu_gl_ext_setTranslation ()

gboolean
visu_gl_ext_setTranslation (VisuGlExt *extension,
                            const gfloat trans[3]);

Change the translation the extension is drawn at.

Parameters

extension

a VisuGlExt method.

 

trans

a translation vector in real space.

[array fixed-size=3]

Returns

TRUE if the translations are indeed changed.

Since: 3.8


visu_gl_ext_getGlList ()

guint
visu_gl_ext_getGlList (VisuGlExt *extension);

All VisuGlExt objects have a master OpenGL list to draw to. This routine gets the identifier of this list.

Parameters

extension

a VisuGlExt method.

 

Returns

an OpenGL identifier id for extension .

Since: 3.7


visu_gl_ext_getLabel ()

const gchar *
visu_gl_ext_getLabel (const VisuGlExt *extension);

Retrieve the name of the extension.

Parameters

extension

a VisuGlExt object.

 

Returns

the name of the extension.

Since: 3.8


visu_gl_ext_call ()

void
visu_gl_ext_call (VisuGlExt *extension,
                  gboolean lastOnly);

Select the VisuGlExt matching the given name and call it. The call is indeed done only if the extension is used. If lastOnly is TRUE, the list is called only if it has a VISU_GL_EXT_PRIORITY_LAST priority. On the contrary the list is called only if its priority is lower than VISU_GL_EXT_PRIORITY_LAST.

Parameters

extension

a VisuGlExt object.

 

lastOnly

a boolean.

 

visu_gl_ext_rebuild ()

void
visu_gl_ext_rebuild (VisuGlExt *self);

This routine does not sort the extension on their priority and should be used only to draw some selected extensions. To draw all of them, use visu_gl_ext_set_rebuild() instead.

Parameters

self

a VisuGlExt object.

 

visu_gl_ext_setGlView ()

gboolean
visu_gl_ext_setGlView (VisuGlExt *ext,
                       VisuGlView *view);

Attach a view to the self extension.

Parameters

ext

a VisuGlExt object.

 

view

a VisuGlView object.

 

Returns

TRUE if the view is changed.

Since: 3.8

Types and Values

VISU_GL_EXT_PRIORITY_BACKGROUND

#define VISU_GL_EXT_PRIORITY_BACKGROUND 0

An extension with this priority is drawn first.


VISU_GL_EXT_PRIORITY_NODES

#define VISU_GL_EXT_PRIORITY_NODES 2

An extension with this priority is drawn alsmost first with the nodes.


VISU_GL_EXT_PRIORITY_NODE_DECORATIONS

#define VISU_GL_EXT_PRIORITY_NODE_DECORATIONS 5

An extension with this priority is drawn just after the nodes.


VISU_GL_EXT_PRIORITY_HIGH

#define VISU_GL_EXT_PRIORITY_HIGH 20

An extension with this priority is drawn after the higher priorities.


VISU_GL_EXT_PRIORITY_NORMAL

#define VISU_GL_EXT_PRIORITY_NORMAL 50

An extension with this priority is drawn after the higher priorities.


VISU_GL_EXT_PRIORITY_LOW

#define VISU_GL_EXT_PRIORITY_LOW 80

An extension with this priority is drawn among last extensions.


VISU_GL_EXT_PRIORITY_LAST

#define VISU_GL_EXT_PRIORITY_LAST 100

An extension with this priority is drawn last.


struct VisuGlExt

struct VisuGlExt;

Common name to refer to a _VisuGlExt.


struct VisuGlExtClass

struct VisuGlExtClass {
  VisuObjectClass parent;

  gboolean (*setGlView)(VisuGlExt *ext, VisuGlView *view);
  void (*rebuild)(VisuGlExt *self);
  void (*draw)(VisuGlExt *self);

  GList *allExtensions;
};

Common name to refer to a _VisuGlExtClass.

Members

VisuObjectClass parent;

private.

 

setGlView ()

a method to attach a VisuGlView object to this extension.

 

rebuild ()

a rebuilding function for this extension.

 

draw ()

a draw method for this extension.

 

GList *allExtensions;

the list of all stored VisuGlExt objects.

 

Property Details

The “active” property

  “active”                   gboolean

extension is used or not.

Flags: Read / Write

Default value: FALSE


The “description” property

  “description”              gchar *

description of extension.

Flags: Read / Write

Default value: ""


The “dirty” property

  “dirty”                    gboolean

object rendering is out of date.

Flags: Read / Write

Default value: FALSE


The “label” property

  “label”                    gchar *

label (translated) of extension.

Flags: Read / Write / Construct

Default value: ""


The “nGlObj” property

  “nGlObj”                   guint

number of GL lists dealt with.

Flags: Read / Write / Construct Only

Allowed values: [1,2048]

Default value: 1


The “name” property

  “name”                     gchar *

name (id) of extension.

Flags: Read / Write / Construct Only

Default value: ""


The “priority” property

  “priority”                 guint

drawing priority of extension.

Flags: Read / Write

Allowed values: <= 100

Default value: 50


The “saveState” property

  “saveState”                gboolean

save OpenGL state.

Flags: Read / Write

Default value: FALSE