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

drawAngle (xyzRef, xyzRef2, xyz, id, drawLength)

class

drawDistance (xyzRef, xyz, drawLength)

class

drawEdgeArrow (centering, tailLength, tailRadius, tailRenderer, hatLength, hatRadius, hatRenderer)

class

drawEllipsoid (obj, aAxis, bAxis, n, renderer)

class

drawSmoothArrow (obj, centering, tailLength, tailRadius, tailN, tailRenderer, hatLength, hatRadius, hatN, hatRenderer)

class

drawTorus (obj, radius, ratio, nA, nB, renderer)

class

objectlist_new (size)

class

rendering_applyMode (mode)

class

rendering_getAllModeLabels ()

class

rendering_getAllModes ()

class

rendering_getModeFromName (name, id)

class

text_drawChars (s, size)

class

text_initFontList ()

class

text_onNewContext ()

class

text_putTextWithFTGL (text, size)

class

text_rebuildFontList ()

class

text_setFontSize (size)

class

text_setFunc (func)

addHint (value)

applyLights ()

drawArrow (origin, vect)

getAntialias ()

getHint ()

getImmediate ()

getLights ()

getMode ()

getStereo ()

getStereoAngle ()

getStereoCapability ()

getTrueTransparency ()

initContext ()

setAntialias (value)

setColor (material, rgba)

setHighlightColor (material, rgb, alpha)

setImmediate (value)

setMode (value)

setStereo (status)

setStereoAngle (angle)

setTrueTransparency (status)

Virtual Methods

Inherited:

GObject.Object (7)

do_initContext ()

Properties

Name

Type

Flags

Short Description

antialias

bool

r/w

antialias line

immediate

bool

r/w

immediate redraw after change

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)

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 drawAngle(xyzRef, xyzRef2, xyz, id, drawLength)
Parameters:
  • xyzRef (float) – cartesian coordinates of first ref.

  • xyzRef2 (float) – cartesian coordinates of second ref.

  • xyz (float) – cartesian coordinates of current point.

  • id (int) – a counter.

  • drawLength (bool) – a boolean.

Draw an angle mark by to distance marks and a disk taking xyzRef as central point and xyzRef2 and xyz as the two positions. id is a counter to obtain different colours for the disk and drawLength is a flag to display or not the angle value in degrees.

New in version 3.6.

classmethod drawDistance(xyzRef, xyz, drawLength)
Parameters:
  • xyzRef (float) – cartesian coordinates of first ref.

  • xyz (float) – cartesian coordinates of current point.

  • drawLength (bool) – a boolean.

Draw a distance mark between xyzRef and xyz. A distance mark is a colour inverted line and two squared marks on node. drawLength is a flag to display or not the distance value.

New in version 3.6.

classmethod drawEdgeArrow(centering, tailLength, tailRadius, tailRenderer, hatLength, hatRadius, hatRenderer)
Parameters:

Draw arrows, using sqaure edges. For rounded arrows, see v_sim.Gl.drawSmoothArrow().

New in version 3.6.

classmethod drawEllipsoid(obj, aAxis, bAxis, n, renderer)
Parameters:

Draw an ellipsoid.

New in version 3.6.

classmethod drawSmoothArrow(obj, centering, tailLength, tailRadius, tailN, tailRenderer, hatLength, hatRadius, hatN, hatRenderer)
Parameters:

Draw arrows, using sqaure edges. For rounded arrows, see v_sim.Gl.drawEdgeArrow().

New in version 3.6.

classmethod drawTorus(obj, radius, ratio, nA, nB, renderer)
Parameters:

Draw a torus.

New in version 3.5.

classmethod objectlist_new(size)
Parameters:

size (int) – the requested size.

Returns:

an identifier used by OpenGl as a list.

Return type:

int

It returns the id that can be used to link glObjectList. This number is also added to the list of glObjectList to be displayed. The size parameter is the number of lists that could be used by the user for this glObjectList. Then the next call to this function will return the last value plus the size plus one.

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.

classmethod text_drawChars(s, size)
Parameters:

Draw the given string on the current raster position with default font.

classmethod text_initFontList()

Initialise the font drawing with default font (depending on system). It must be called before v_sim.Gl.text_drawChars() and not in a glNewList(). Can be called several times, fonts are initialized once only. Use v_sim.Gl.text_rebuildFontList() to force to build a new font list.

classmethod text_onNewContext()

Set the flag for text list build to False. It will force to rebuild the text lists at next call of v_sim.Gl.text_initFontList().

New in version 3.6.

classmethod text_putTextWithFTGL(text, size)
Parameters:

A v_sim.GlTextFunc routine using FTGL to render text with Pixmap lists, see v_sim.Gl.text_setFunc().

New in version 3.7.

classmethod text_rebuildFontList()

Force to buid a new font list (for example new context has changed.

classmethod text_setFontSize(size)
Parameters:

size (float) – a new size.

Returns:

True if font size is indeed changed.

Return type:

bool

Change the normal font size used by V_Sim (see v_sim.GlTextSize.NORMAL). The small font is scaled accordingly. This is working only with the FTGL backend.

New in version 3.7.

classmethod text_setFunc(func)
Parameters:

func (v_sim.GlTextFunc or None) – a v_sim.GlTextFunc function

Returns:

True if the function is indeed changed.

Return type:

bool

Set the function to render text at the raster position.

New in version 3.7.

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.

drawArrow(origin, vect)
Parameters:
  • origin ([float]) – Position of the centre of the arrow.

  • vect ([float]) – Vector coordinates.

Draw an arrow defined by vect centred at origin. For a lower level function, see v_sim.Gl.drawSmoothArrow().

New in version 3.8.

getAntialias()
Returns:

wether or not the antialising for lines is activated.

Return type:

bool

Get the value of the antialiasing parameter.

getHint()
Returns:

the mask of current hints.

Return type:

int

Retrieve hints of self.

New in version 3.8.

getImmediate()
Returns:

the value of the immediateDrawing option.

Return type:

bool

Get the value of the immediateDrawing option.

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

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.

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.

setColor(material, rgba)
Parameters:
  • material ([float]) – a 5 elements array with the material properties ;

  • rgba ([float]) – a 4 elements array with the color values.

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

setHighlightColor(material, rgb, alpha)
Parameters:
  • material (float) – a 5 elements array with the material properties ;

  • rgb (float) – a 3 elements array with the color values.

  • alpha (float) – the alpha channel.

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

setImmediate(value)
Parameters:

value (bool) – a boolean to set or not the immediateDrawing option.

Returns:

True if the value is changed.

Return type:

bool

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

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_initContext() virtual

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.

Property Details

v_sim.Gl.props.antialias
Name:

antialias

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

antialias line

v_sim.Gl.props.immediate
Name:

immediate

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

immediate redraw after change

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