VisuGlExt

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

Synopsis

#define             VISU_GL_EXT_PRIORITY_BACKGROUND
#define             VISU_GL_EXT_PRIORITY_HIGH
#define             VISU_GL_EXT_PRIORITY_LAST
#define             VISU_GL_EXT_PRIORITY_LOW
#define             VISU_GL_EXT_PRIORITY_NODES
#define             VISU_GL_EXT_PRIORITY_NODE_DECORATIONS
#define             VISU_GL_EXT_PRIORITY_NORMAL
struct              VisuGlExt;
struct              VisuGlExtClass;
                    VisuGlExtClassPrivate;
void                visu_gl_ext_call                    (VisuGlExt *extension,
                                                         gboolean lastOnly);
gboolean            visu_gl_ext_getActive               (VisuGlExt *extension);
GList *             visu_gl_ext_getAll                  (void);
VisuGlExt *         visu_gl_ext_getFromName             (const char *name);
guint               visu_gl_ext_getGlList               (VisuGlExt *extension);
VisuGlRenderingMode visu_gl_ext_getPreferedRenderingMode
                                                        (VisuGlExt *extension);
gboolean            visu_gl_ext_getSensitiveToRenderingMode
                                                        (VisuGlExt *extension);
void                visu_gl_ext_rebuild                 (VisuGlExt *self);
void                visu_gl_ext_rebuildAll              (void);
gboolean            visu_gl_ext_setActive               (VisuGlExt *extension,
                                                         gboolean value);
gboolean            visu_gl_ext_setPreferedRenderingMode
                                                        (VisuGlExt *extension,
                                                         VisuGlRenderingMode value);
void                visu_gl_ext_setPriority             (VisuGlExt *extension,
                                                         guint priority);
void                visu_gl_ext_setSaveState            (VisuGlExt *extension,
                                                         gboolean saveState);
void                visu_gl_ext_setSensitiveToRenderingMode
                                                        (VisuGlExt *extension,
                                                         gboolean status);

Object Hierarchy

  GObject
   +----VisuGlExt
         +----VisuGlExtAxes
         +----VisuGlExtBg
         +----VisuGlExtBox
         +----VisuGlExtFrame
         +----VisuGlExtNodeVectors
         +----VisuGlExtInfos
         +----VisuGlExtMaps
         +----VisuGlExtMarks
         +----VisuGlExtNodes
         +----VisuGlExtPairs
         +----VisuGlExtPaths
         +----VisuGlExtPlanes
         +----VisuGlExtScale
         +----VisuGlExtSurfaces

Properties

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

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.

Details

VISU_GL_EXT_PRIORITY_BACKGROUND

#define VISU_GL_EXT_PRIORITY_BACKGROUND 0

An extension with this priority is drawn first.


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_LAST

#define VISU_GL_EXT_PRIORITY_LAST 100

An extension with this priority is drawn last.


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_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_NORMAL

#define VISU_GL_EXT_PRIORITY_NORMAL 50

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


struct VisuGlExt

struct VisuGlExt;

Common name to refer to a _VisuGlExt.


struct VisuGlExtClass

struct VisuGlExtClass {
  GObjectClass parent;

  void (*rebuild)(VisuGlExt *self);

  VisuGlExtClassPrivate *priv;
};

Common name to refer to a _VisuGlExtClass.

GObjectClass parent;

private.

rebuild ()

a rebuilding function for this extension.

VisuGlExtClassPrivate *priv;

private.

VisuGlExtClassPrivate

typedef struct _VisuGlExtClassPrivate VisuGlExtClassPrivate;

Private data for VisuGlExtClass classes.


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.

extension :

a VisuGlExt object.

lastOnly :

a boolean.

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.

extension :

the extension.

Returns :

TRUE if used, FALSE otherwise.

visu_gl_ext_getAll ()

GList *             visu_gl_ext_getAll                  (void);

This method is used to get the list of all registered VisuGlExt. This list is own by V_Sim and should not be freed.

Returns :

the list of all VisuGlExt. [element-type VisuGlExt*][transfer none]

visu_gl_ext_getFromName ()

VisuGlExt *         visu_gl_ext_getFromName             (const char *name);

VisuGlExt objects are identified by an id.

name :

a string identifying a VisuGlExt object.

Returns :

a VisuGlExt object matching name. [transfer none]

Since 3.7


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.

extension :

a VisuGlExt method.

Returns :

an OpenGL identifier id for extension.

Since 3.7


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

extension :

a VisuGlExt method.

Returns :

the prefered rendering mode of this extension.

Since 3.7


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

extension :

a VisuGlExt object.

Returns :

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

Since 3.7


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_rebuildAll() instead.

self :

a VisuGlExt object.

visu_gl_ext_rebuildAll ()

void                visu_gl_ext_rebuildAll              (void);

For each registered extension that has a valid rebuild method, it calls it.


visu_gl_ext_setActive ()

gboolean            visu_gl_ext_setActive               (VisuGlExt *extension,
                                                         gboolean value);

Set if an extension is actually used or not.

extension :

the extension,

value :

the new value.

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.

extension :

a VisuGlExt object ;

value :

see VisuGlRenderingMode to choose one.

Returns :

TRUE if the "OpenGLAskForReDraw" should be emitted.

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.

extension :

a VisuGlExt object ;

priority :

an integer value.

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.

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.

extension :

a VisuGlExt object ;

status :

an boolean value.

Property Details

The "active" property

  "active"                   gboolean              : Read / Write

extension is used or not.

Default value: FALSE


The "description" property

  "description"              gchar*                : Read / Write

description of extension.

Default value: ""


The "label" property

  "label"                    gchar*                : Read / Write / Construct

label (translated) of extension.

Default value: ""


The "nGlObj" property

  "nGlObj"                   guint                 : Read / Write / Construct Only

number of GL lists dealt with.

Allowed values: [1,2048]

Default value: 1


The "name" property

  "name"                     gchar*                : Read / Write / Construct Only

name (id) of extension.

Default value: ""


The "priority" property

  "priority"                 guint                 : Read / Write

drawing priority of extension.

Allowed values: <= 100

Default value: 50


The "saveState" property

  "saveState"                gboolean              : Read / Write

save OpenGL state.

Default value: FALSE