v_sim.Gl

g GObject.Object GObject.Object v_sim.Gl v_sim.Gl GObject.Object->v_sim.Gl

Subclasses:

v_sim.GlExtSet

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

createColoredLineShader (withFog)

class

createFlatShader (withFog)

class

createLineShader (withFog)

class

createMaterialShader (withFog)

class

createOrthoShader ()

class

createShader (vertexSource, fragmentSource)

class

createSimpleShader (withFog)

class

createTextShader (withFog)

class

rendering_applyMode (mode)

class

rendering_getAllModeLabels ()

class

rendering_getAllModes ()

class

rendering_getModeFromName (name, id)

addHint (value)

applyLights ()

freeContext ()

getAntialias ()

getBgColor ()

getFogActive ()

getFogColor ()

getFogFollowsBg ()

getFogSpecificColor ()

getFogStartFull ()

getHint ()

getLights ()

getMode ()

getStereo ()

getStereoAngle ()

getStereoCapability ()

getTrueTransparency ()

initContext ()

paint ()

removeHint (value)

setAntialias (value)

setBgColor (rgba, mask)

setFogActive (value)

setFogColor (rgba, mask)

setFogFollowsBg (value)

setFogStartFull (startEnd, mask)

setMode (value)

setStereo (status)

setStereoAngle (angle)

setTrueTransparency (status)

Virtual Methods

Inherited:

GObject.Object (7)

do_draw ()

do_freeContext ()

do_initContext ()

do_render ()

Properties

Name

Type

Flags

Short Description

antialias

bool

r/w

antialias line

bg-alpha

float

r/w

background alpha channel

bg-blue

float

r/w

background blue channel

bg-green

float

r/w

background green channel

bg-red

float

r/w

background red channel

fog-active

bool

r/w

Fog is used

fog-alpha

float

r/w

specific fog alpha channel

fog-blue

float

r/w

specific fog blue channel

fog-follows-bg

bool

r/w

Fog color is the bg color

fog-full

float

r/w

depth where fog hides all

fog-green

float

r/w

specific fog green channel

fog-red

float

r/w

specific fog red channel

fog-start

float

r/w

starting fog depth

lights

v_sim.GlLights

r

light environment

mode

int

r/w

global rendering mode

stereo

bool

r/w

differenciate right and left buffer

stereo-angle

float

r/w

angle between left and right buffers

true-transparency

bool

r/w

draw in two passes to improve transparency

Signals

Inherited:

GObject.Object (1)

Name

Short Description

dirty

Gets emitted when the OpenGL scene is dirty and requires a redraw.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

priv

v_sim.GlPrivate

r

Class Details

class v_sim.Gl(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

v_sim.GlClass

Common name to refer to a #_VisuGl.

classmethod createColoredLineShader(withFog)
Parameters:

withFog (bool) – a boolean.

Raises:

GLib.Error

Returns:

True on success.

id:

a location for a GL id.

locs:

an array to store possible uniform ids.

Return type:

(bool, id: int, locs: int)

Create a GLSL program rendering lines which colours depend on the vertices. On success, the GL id for the program is stored in id. It will be sensitive to fog according to withFog.

New in version 3.9.

classmethod createFlatShader(withFog)
Parameters:

withFog (bool) – a boolean.

Raises:

GLib.Error

Returns:

True on success.

id:

a location for a GL id.

locs:

an array to store possible uniform ids.

Return type:

(bool, id: int, locs: int)

Create a GLSL program rendering flat colours independant on the vertices. On success, the GL id for the program is stored in id. It will be sensitive to fog according to withFog.

New in version 3.9.

classmethod createLineShader(withFog)
Parameters:

withFog (bool) – a boolean.

Raises:

GLib.Error

Returns:

True on success.

id:

a location for a GL id.

locs:

an array to store possible uniform ids.

Return type:

(bool, id: int, locs: int)

Create a GLSL program rendering lines with fixed colours. On success, the GL id for the program is stored in id. It will be sensitive to fog according to withFog.

New in version 3.9.

classmethod createMaterialShader(withFog)
Parameters:

withFog (bool) – a boolean.

Raises:

GLib.Error

Returns:

True on success.

id:

a location for a GL id.

locs:

an array to store possible uniform ids.

Return type:

(bool, id: int, locs: int)

Create a GLSL program rendering surfaces with light effects. On success, the GL id for the program is stored in id. It will be sensitive to fog according to withFog.

New in version 3.9.

classmethod createOrthoShader()
Raises:

GLib.Error

Returns:

True on success.

id:

a location for a GL id.

locs:

an array to store possible uniform ids.

Return type:

(bool, id: int, locs: int)

Create a GLSL program rendering per vertex colours in the window coordinates. On success, the GL id for the program is stored in id.

New in version 3.9.

classmethod createShader(vertexSource, fragmentSource)
Parameters:
  • vertexSource (str) – some GLSL code for vertices.

  • fragmentSource (str) – some GLSL code for fragments.

Raises:

GLib.Error

Returns:

True on success.

id:

a location for a GL id.

Return type:

(bool, id: int)

Create a GLSL program using vertexSource and fragmentSource. On success, the GL id for the program is stored in id.

New in version 3.9.

classmethod createSimpleShader(withFog)
Parameters:

withFog (bool) – a boolean.

Raises:

GLib.Error

Returns:

True on success.

id:

a location for a GL id.

locs:

an array to store possible uniform ids.

Return type:

(bool, id: int, locs: int)

Create a GLSL program rendering colours which depend on the vertices. On success, the GL id for the program is stored in id. It will be sensitive to fog according to withFog.

New in version 3.9.

classmethod createTextShader(withFog)
Parameters:

withFog (bool) – a boolean.

Raises:

GLib.Error

Returns:

True on success.

id:

a location for a GL id.

locs:

an array to store possible uniform ids.

Return type:

(bool, id: int, locs: int)

Create a GLSL program rendering textures for text. On success, the GL id for the program is stored in id. It will be sensitive to fog according to withFog.

New in version 3.9.

classmethod rendering_applyMode(mode)
Parameters:

mode (v_sim.GlRenderingMode) – an integer.

Change the rendering mode of current OpenGL context.

classmethod rendering_getAllModeLabels()
Returns:

an array of string, None terminated that is private (not to be freed).

Return type:

[str]

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

classmethod rendering_getAllModes()
Returns:

an array of string, None terminated that is private (not to be freed).

Return type:

[str]

This function retrieve al the names of available rendering modes.

classmethod rendering_getModeFromName(name, id)
Parameters:
Returns:

True if the name exists.

Return type:

bool

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

addHint(value)
Parameters:

value (int) – a mask of hints.

Returns:

the mask of current hints.

Return type:

int

Set some additional hints to self.

New in version 3.8.

applyLights()

If self has some defined lights, it setup the OpenGL context with them and notify the “lights” parameter.

New in version 3.8.

freeContext()

This method is called when an OpenGL surface is destroyed to free OpenGL resources.

New in version 3.9.

getAntialias()
Returns:

wether or not the antialising for lines is activated.

Return type:

bool

Get the value of the antialiasing parameter.

getBgColor()
Returns:

a storage for four values.

Return type:

rgba: [float]

Read the RGBA value of the specific background colour (in [0;1]).

New in version 3.8.

getFogActive()
Returns:

True if the fog is rendered, False otherwise.

Return type:

bool

Read if fog is used or not.

New in version 3.8.

getFogColor()
Returns:

a storage for three values.

Return type:

rgba: [float]

Gives the actual fog color, for the specific color, use v_sim.Gl.getFogSpecificColor().

New in version 3.8.

getFogFollowsBg()
Returns:

True if the fog uses its own color or False if it uses the color of the background.

Return type:

bool

Read if fog uses a specific colour or not.

New in version 3.8.

getFogSpecificColor()
Returns:

a storage for three values.

Return type:

rgba: [float]

Gives the specific fog color, for the actual color, use v_sim.Gl.getFogColor().

New in version 3.8.

getFogStartFull()
Returns:

two float location.

Return type:

startFull: [float]

Retrieves the starting and ending value (reduced) of fog extension.

New in version 3.8.

getHint()
Returns:

the mask of current hints.

Return type:

int

Retrieve hints of self.

New in version 3.8.

getLights()
Returns:

the set of current lights.

Return type:

v_sim.GlLights

V_Sim proposes a wrapper around the OpenGL light definitions.

getMode()
Returns:

the identifier of the current rendering option.

Return type:

v_sim.GlRenderingMode

This function retrieve the value of the parameter renderingOption.

getStereo()
Returns:

True if the surface try to draw in stereo (may be True, even if v_sim.Gl.getStereoCapability() returns False, in that case the stereo capability is not used).

Return type:

bool

Retrieve the status of the OpenGL surface.

getStereoAngle()
Returns:

the angle.

Return type:

float

Retrieve the angle of the eyes in the stereo output.

getStereoCapability()
Returns:

True if the OpenGL surface can draw in stereo.

Return type:

bool

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

getTrueTransparency()
Returns:

True if the drawing is done twice.

Return type:

bool

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

initContext()
Raises:

GLib.Error

Returns:

False on error.

Return type:

bool

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.

paint()

This method is called when it’s necessary to redraw.

removeHint(value)
Parameters:

value (int) – a mask of hints.

Returns:

the mask of current hints.

Return type:

int

Remove an additional hints from self.

New in version 3.9.

setAntialias(value)
Parameters:

value (bool) – a boolean to activate or not the lines antialias.

Returns:

True if value is actually changed.

Return type:

bool

To set the antialiasing on lines.

setBgColor(rgba, mask)
Parameters:
Returns:

True if changed.

Return type:

bool

Method used to change the value of the parameter background_color.

New in version 3.8.

setFogActive(value)
Parameters:

value (bool) – a boolean.

Returns:

True if value is actually changed.

Return type:

bool

Activates the fog rendering, or not.

New in version 3.8.

setFogColor(rgba, mask)
Parameters:
Returns:

True if value is actually changed.

Return type:

bool

Change the fog specific colour. Activate it with v_sim.Gl.setFogFollowsBg().

New in version 3.8.

setFogFollowsBg(value)
Parameters:

value (bool) – a boolean.

Returns:

True if value is actually changed.

Return type:

bool

Specifies if the fog is coloured with the background colour or with its own colour, see v_sim.Gl.setFogColor().

New in version 3.8.

setFogStartFull(startEnd, mask)
Parameters:
Returns:

True if values are actually changed.

Return type:

bool

Change the starting and ending point of fog.

New in version 3.8.

setMode(value)
Parameters:

value (v_sim.GlRenderingMode) – an integer to represent the method of rendering.

Returns:

True if value is actually changed.

Return type:

bool

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

setStereo(status)
Parameters:

status (bool) – a boolean.

Return type:

bool

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

setStereoAngle(angle)
Parameters:

angle (float) – a positive floating point value.

Returns:

True if redraw should be done.

Return type:

bool

Change the angle of the eyes in the stereo output.

setTrueTransparency(status)
Parameters:

status (bool) – a boolean.

Returns:

True if redraw should be done.

Return type:

bool

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

do_draw() virtual

called to compute the object to be sent to the GPU.

do_freeContext() virtual

This method is called when an OpenGL surface is destroyed to free OpenGL resources.

New in version 3.9.

do_initContext() virtual
Returns:

False on error.

Return type:

bool

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.

do_render() virtual

called to run drawing primitives on GPU.

Signal Details

v_sim.Gl.signals.dirty(gl)
Signal Name:

dirty

Flags:

RUN_LAST, NO_RECURSE, NO_HOOKS

Parameters:

gl (v_sim.Gl) – The object which received the signal

Gets emitted when the OpenGL scene is dirty and requires a redraw.

New in version 3.9.

Property Details

v_sim.Gl.props.antialias
Name:

antialias

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

antialias line

v_sim.Gl.props.bg_alpha
Name:

bg-alpha

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

background alpha channel

v_sim.Gl.props.bg_blue
Name:

bg-blue

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

background blue channel

v_sim.Gl.props.bg_green
Name:

bg-green

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

background green channel

v_sim.Gl.props.bg_red
Name:

bg-red

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

background red channel

v_sim.Gl.props.fog_active
Name:

fog-active

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Fog is used

v_sim.Gl.props.fog_alpha
Name:

fog-alpha

Type:

float

Default Value:

1.0

Flags:

READABLE, WRITABLE

specific fog alpha channel

v_sim.Gl.props.fog_blue
Name:

fog-blue

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

specific fog blue channel

v_sim.Gl.props.fog_follows_bg
Name:

fog-follows-bg

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Fog color is the bg color

v_sim.Gl.props.fog_full
Name:

fog-full

Type:

float

Default Value:

0.699999988079071

Flags:

READABLE, WRITABLE

depth where fog hides all

v_sim.Gl.props.fog_green
Name:

fog-green

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

specific fog green channel

v_sim.Gl.props.fog_red
Name:

fog-red

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

specific fog red channel

v_sim.Gl.props.fog_start
Name:

fog-start

Type:

float

Default Value:

0.30000001192092896

Flags:

READABLE, WRITABLE

starting fog depth

v_sim.Gl.props.lights
Name:

lights

Type:

v_sim.GlLights

Default Value:

None

Flags:

READABLE

light environment

v_sim.Gl.props.mode
Name:

mode

Type:

int

Default Value:

2

Flags:

READABLE, WRITABLE

global rendering mode

v_sim.Gl.props.stereo
Name:

stereo

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

differenciate right and left buffer

v_sim.Gl.props.stereo_angle
Name:

stereo-angle

Type:

float

Default Value:

5.0

Flags:

READABLE, WRITABLE

angle between left and right buffers

v_sim.Gl.props.true_transparency
Name:

true-transparency

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

draw in two passes to improve transparency