v_sim.GlExt¶
- Subclasses:
v_sim.GlExtAxes,v_sim.GlExtBg,v_sim.GlExtBox,v_sim.GlExtFrame,v_sim.GlExtInfos,v_sim.GlExtMaps,v_sim.GlExtMarks,v_sim.GlExtNodeVectors,v_sim.GlExtNodes,v_sim.GlExtPairs,v_sim.GlExtPaths,v_sim.GlExtPlanes,v_sim.GlExtScale,v_sim.GlExtSurfaces
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
|
|
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w |
extension is used or not |
||
r/w |
description of extension |
||
r/w |
object rendering is out of date |
||
r/w/c |
label (translated) of extension |
||
r/w/co |
number of GL lists dealt with |
||
r/w/co |
number of GL kernels dealt with |
||
r/w/co |
number of GL textures dealt with |
||
r/w/co |
name (id) of extension |
||
r/w/c |
drawing priority of extension |
||
r/w |
specific rendering mode for the extension |
||
r/w/co |
rendering is impacted by fog |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
|---|---|---|---|
parent |
r |
||
priv |
r |
Class Details¶
- class v_sim.GlExt(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Common name to refer to a #_VisuGlExt.
- addBuffers(number)¶
- Parameters:
number (
int) – a number.- Returns:
the index to be used in
v_sim.GlExt.getGlBuffer(), orGObject.G_MAXUINTon error.- Return type:
Create number additional buffers. This method should be called only for the current OpenGL context. This should be used only for
v_sim.GlExtwith varying number of array buffers. Otherwise, the number of array buffers should be declared as a class parameter.New in version 3.9.
- addTextures(number)¶
- Parameters:
number (
int) – a number.- Returns:
the index to be used in
v_sim.GlExt.blitTextureAt() for instance, orGObject.G_MAXUINTon error.- Return type:
Create number new available 2D textures. This method should be called only for the current OpenGL context. This should be used only for
v_sim.GlExtwith varying number of textures. Otherwise, the number of textures should be declared as a constructor parameter.New in version 3.9.
- adjustTextureDimensions(texId, width, height)¶
- Parameters:
Adjust texture rendering dimension by hand. By default, textures are not scaled.
New in version 3.9.
- blitLabels()¶
Draw all labels at the stored position in the scene. See
v_sim.GlExt.setLabels().New in version 3.9.
- blitLabelsOnScreen()¶
Draw all labels at the stored position on the screen. See
v_sim.GlExt.setLabels().New in version 3.9.
- blitTextureAt(texId, at, offset)¶
- Parameters:
Displays the texture referred by texId at a position in the scene given by at. The offset is applied in model view space, making it independant of the camera position.
New in version 3.9.
- blitTextureOnScreen(texId, at, hAlign, vAlign)¶
- Parameters:
texId (
int) – a texture id.at (
float) – two coordinates in [0.;1.].hAlign (
v_sim.GlExtAlignments) – horizontal alignment.vAlign (
v_sim.GlExtAlignments) – vertical alignment.
Draw the texture referred by texId at the position at on screen. The texture is positioned on at.
New in version 3.9.
- bookBuffers(number)¶
- Parameters:
number (
int) – a number.
Ensure that extension can use up to number array buffers. This method should be called only for the current OpenGL context. This should be used only for
v_sim.GlExtwith varying number of array buffers. Otherwise, the number of array buffers should be declared as a class parameter.New in version 3.9.
- bookTextures(number)¶
- Parameters:
number (
int) – a number.
Ensure that extension can use up to number 2D textures. This method should be called only for the current OpenGL context. This should be used only for
v_sim.GlExtwith varying number of textures. Otherwise, the number of textures should be declared as a constructor parameter.New in version 3.9.
- call(globals)¶
- Parameters:
globals (
v_sim.GlExtGlobals) – global uniform values.
Select the
v_sim.GlExtmatching the given name and call it. The call is indeed done only if the extension is used. If lastOnly isTrue, the list is called only if it has av_sim.GL_EXT_PRIORITY_LASTpriority. On the contrary the list is called only if its priority is lower thanv_sim.GL_EXT_PRIORITY_LAST.
- callText(globals)¶
- Parameters:
globals (
v_sim.GlExtGlobals) – global uniform values.
Specifically call the text render routine for self.
New in version 3.9.
- clearBuffers()¶
Empty all buffers of this extension.
New in version 3.9.
- clearLabels()¶
Remove all labels displayed by this extension.
New in version 3.9.
- cullFace(status)¶
- Parameters:
status (
bool) – a boolean.
Render or not polygons pointing inside.
New in version 3.9.
- draw()¶
Send object data of self to GPU, if necessary.
New in version 3.9.
- getActive()¶
-
Get if the extension is used or not.
- getBufferDimension()¶
- Returns:
a GL buffer index.
- Return type:
Retrieve the size of the current buffer set with
v_sim.GlExt.setBuffer().New in version 3.9.
- getGlBuffer(id)¶
-
Retrieve the OpenGL index used to identify the id buffer.
New in version 3.9.
- getName()¶
- Returns:
the name of the extension.
- Return type:
Retrieve the name of the extension.
New in version 3.8.
- getPreferedRenderingMode()¶
- Returns:
the prefered rendering mode of this self.
- Return type:
Each
v_sim.GlExtmethod can draw in a mode different from the global one, seev_sim.GlRenderingMode. See alsov_sim.GlExt.setPreferedRenderingMode().New in version 3.7.
- getPriority()¶
- Returns:
the
v_sim.GlExtpriority.- Return type:
Inquire the priority of self.
New in version 3.8.
- getTranslation()¶
- Returns:
a location to store the translation.
- Return type:
trans: [
float]
Inquire the translation the extension is drawn with.
New in version 3.9.
- layoutBuffer(id, data)¶
-
Count the number of element added to data with respect to last call. This allow to construct a data buffer with various blocks than need to be drawn together.
New in version 3.9.
- layoutBufferWithColor(id, data, rgba, material)¶
- Parameters:
id (
int) – a buffer id.data ([
float]) – some data, usingv_sim.GlExtPackingModels.XYZorv_sim.GlExtPackingModels.XYZ_NRMpacking.rgba ([
float]) – some colour definition.material ([
float]) – some material definition.
Add a new group of vertices defined in data. Vertices will be rendered using a lighting effect defined by rgba and material. If a flat coloured rendering should be used instead, consider using a
v_sim.GlExtPackingModels.RGBA_XYZpacking instead, so the colour can also be transmitted to the GPU.New in version 3.9.
- rebuild()¶
This routine does not sort the extension on their priority and should be used only to draw some selected extensions. This method is called automatically for all extensions in a
v_sim.GlExtSetwhen required.
- release()¶
This routine frees the OpenGL resources when not needed anymore for the current context.
- renderBuffer(id)¶
- Parameters:
id (
int) – a buffer id.
Render the buffer identified by id for self.
New in version 3.9.
- renderBufferWithPrimitive(id, primitive, rgba)¶
- Parameters:
id (
int) – a buffer id.primitive (
v_sim.GlExtPrimitives) – av_sim.GlExtPrimitivesvalue.
Render the buffer identified by id, overloading its own rendering primitive with primitive. If rgba is provided this colour is used instead of the vertice colors.
New in version 3.9.
- renderBuffers()¶
Render all the declared buffers for self.
New in version 3.9.
- setActive(value)¶
-
Set if an extension is actually used or not.
- setBuffer(id, data)¶
-
Transfer data to the GL buffer id.
New in version 3.9.
- setBufferWithAttrib(id, data, iProg, attribs)¶
- Parameters:
id (
int) – a buffer id.data ([
float]) – the buffer data.iProg (
int) – a shader id.attribs (
v_sim.GlExtAttrib) – the data layout for the shader.
Transfer data to the GPU.
New in version 3.9.
- setDirty(status)¶
- Parameters:
status (
v_sim.GlExtDirtyStates) – av_sim.GlExtDirtyStatesvalue.- Returns:
Trueis status is actually changed.- Return type:
Set an internal flag to mark that self should be redrawn before next OpenGL frame view.
New in version 3.8.
- setGlContext(gl)¶
- Parameters:
- Returns:
Trueif the value is actually changed.- Return type:
Associate gl to self.
New in version 3.8.
- setGlView(view)¶
- Parameters:
view (
v_sim.GlView) – av_sim.GlViewobject.- Returns:
Trueif the view is changed.- Return type:
Attach a view to the self extension.
New in version 3.8.
- setImage(texId, pixels, width, height, hasAlpha)¶
- Parameters:
Upload pixels to the graphic card in the texture registered as texId. The texId must be within 0 and nGlTex property value. The storage of pixels must be RGB or RGBA unsigned bytes.
New in version 3.9.
- setLabels(labels, size, stroke)¶
- Parameters:
labels ([
v_sim.GlExtLabel]) – a set of labels.size (
v_sim.WriterFontSize) – the font size.stroke (
bool) – a boolean.
Store a set of texts to be drawn in the scene at given positions with given colours. These labels will be rendered using the given size and maybe outlined by a black stroke.
New in version 3.9.
- setPreferedRenderingMode(value)¶
- Parameters:
value (
v_sim.GlRenderingMode) – seev_sim.GlRenderingModeto choose one.- Returns:
Trueif value is actually changed.- Return type:
This method is used to specify the rendering mode that the extension should use to be drawn. If the value is set to
v_sim.GlRenderingMode.FOLLOW, the extension follows the global setting for rendering mode.
- setShader(id, vertexSource, fragmentSource, uniforms)¶
- Parameters:
- Raises:
- Returns:
Trueon success.- Return type:
Create the shader defined by vertexSource and fragmentSource and affect it to id.
New in version 3.9.
- setShaderById(id, shader)¶
- Parameters:
id (
int) – a shader id.shader (
v_sim.GlExtShaderIds) – a predefined shader id.
- Raises:
- Returns:
Trueon success.- Return type:
Create the shader defined by shader and affect it to id.
New in version 3.9.
- setTexture2D(texId, pixels, width, height)¶
- Parameters:
Upload pixels to the graphic card in the texture registered as texId. The texId must be within 0 and nGlTex property value. The storage of pixels must be ARGB unsigned bytes.
New in version 3.9.
- setTranslation(trans)¶
- Parameters:
trans ([
float]) – a translation vector in real space.- Returns:
Trueif the translations are indeed changed.- Return type:
Change the translation the extension is drawn at.
New in version 3.8.
- setUniformCamera(iProg, xyz)¶
-
If iProg is using
v_sim.GlUniformIds.NIFORM_CAMERA_POS, then xyz is send to the GPU. It is using the current shader if it corresponds to iProg, otherwise the current program is bound to iProg and then unbound.New in version 3.9.
- setUniformMV(iProg, MV)¶
- Parameters:
iProg (
int) – a shader id.MV (
v_sim.GlMatrix) – av_sim.GlMatrixobject.
If iProg is using
v_sim.GlUniformIds.NIFORM_MV, then MV is send to the GPU. It is using the current shader if it corresponds to iProg, otherwise the current program is bound to iProg and then unbound.New in version 3.9.
- setUniformMVP(iProg, MVP)¶
- Parameters:
iProg (
int) – a shader id.MVP (
v_sim.GlMatrix) – av_sim.GlMatrixobject.
If iProg is using
v_sim.GlUniformIds.NIFORM_MVP, then MVP is send to the GPU. It is using the current shader if it corresponds to iProg, otherwise the current program is bound to iProg and then unbound.New in version 3.9.
- setUniformMaterial(material)¶
- Parameters:
material ([
float]) – a material.
Send material to the GPU using the various uniforms used for light.
New in version 3.9.
- setUniformRGBA(rgba)¶
- Parameters:
rgba ([
float]) – a color.
Send rgba to the GPU using the uniform defined by
v_sim.GlUniformIds.NIFORM_COLOR.New in version 3.9.
- setUniformStipple(stipple)¶
- Parameters:
stipple (
int) – a stipple pattern.
Send stipple to the GPU using the uniform
v_sim.GlUniformIds.NIFORM_STIPPLE.New in version 3.9.
- setUniformTexMVP(MVP)¶
- Parameters:
MVP (
v_sim.GlMatrix) – av_sim.GlMatrixobject.
Send MVP to the GPU for the texture shader.
New in version 3.9.
- setUniformTexRGBA(rgba)¶
- Parameters:
rgba ([
float]) – a color.
Send rgba to the GPU for the texture shader.
New in version 3.9.
- setUniformTexResolution(w, h)¶
-
Send (w,`h`) to the GPU for the texture shader.
New in version 3.9.
- setUniformXYZ(id, xyz)¶
-
Send xyz to the GPU using the uniform defined by id.
New in version 3.9.
- setViewport(x, y, width, height)¶
- Parameters:
Change the current viewport.
New in version 3.9.
- startBuffer(iProg, id, layout, primitive)¶
- Parameters:
iProg (
int) – a shader id.id (
int) – a buffer id.layout (
v_sim.GlExtPackingModels) – av_sim.GlExtPackingModelsvalue.primitive (
v_sim.GlExtPrimitives) – av_sim.GlExtPrimitivesvalue.
- Returns:
a new
GLib.Arraystructure to store the vertice data in CPU memory before transfering them to GPU.- Return type:
[
float]
Create a new data buffer, identified by id. The data storage layout in GPU memory is defined by layout and the prefered rendering scheme is defined by primitive.
New in version 3.9.
- startRenderShader(shaderId, bufId)¶
-
Load the given shaderId and bind the data buffer defined by bufId.
New in version 3.9.
- stopRenderShader(shaderId, bufId)¶
-
Stop using the given shaderId and unbind the data buffer defined by bufId.
New in version 3.9.
- takeBuffer(id, data)¶
-
Transfer all CPU data stored in data into a GPU buffer identified by id.
New in version 3.9.
- takeBufferWithAttribs(id, data, iProg, attribs)¶
- Parameters:
id (
int) – a buffer id.data ([
float]) – some vertice data.iProg (
int) – a program id.attribs (
v_sim.GlExtAttrib) – the data layout.
Transfer all CPU data stored in data into a GPU buffer identified by id.
New in version 3.9.
- transferBuffer(id, buffer, offset)¶
-
Transfer buffer data to the GPU at the position given by offset in the data buffer allocated for id.
New in version 3.9.
- do_draw() virtual¶
Send object data of ext to GPU, if necessary.
New in version 3.9.
- do_rebuild() virtual¶
This routine does not sort the extension on their priority and should be used only to draw some selected extensions. This method is called automatically for all extensions in a
v_sim.GlExtSetwhen required.
- do_release() virtual¶
This routine frees the OpenGL resources when not needed anymore for the current context.
- do_render() virtual¶
a method called at each OpenGL rendering cycle.
- do_renderText() virtual¶
a method called at each OpenGL rendering cycle, dedicated to text rendering.
- do_setGlView(view) virtual¶
- Parameters:
view (
v_sim.GlView) – av_sim.GlViewobject.- Returns:
Trueif the view is changed.- Return type:
Attach a view to the self extension.
New in version 3.8.
Property Details¶
- v_sim.GlExt.props.active¶
-
extension is used or not
- v_sim.GlExt.props.description¶
-
description of extension
- v_sim.GlExt.props.dirty¶
-
object rendering is out of date
- v_sim.GlExt.props.label¶
-
label (translated) of extension
- v_sim.GlExt.props.nGlObj¶
- Name:
nGlObj- Type:
- Default Value:
0- Flags:
number of GL lists dealt with
- v_sim.GlExt.props.nGlProg¶
- Name:
nGlProg- Type:
- Default Value:
0- Flags:
number of GL kernels dealt with
- v_sim.GlExt.props.nGlTex¶
- Name:
nGlTex- Type:
- Default Value:
0- Flags:
number of GL textures dealt with
- v_sim.GlExt.props.name¶
- Name:
name- Type:
- Default Value:
''- Flags:
name (id) of extension
- v_sim.GlExt.props.priority¶
-
drawing priority of extension
- v_sim.GlExt.props.rendering_mode¶
-
specific rendering mode for the extension