This object can be used to write custom OpenGL scripts for 3D rendering. The rendering script can reference any data exposed to the scripting engine.
Most OpenGL 1.1 functions and constants (as defined in the gl.h C header) are available, execpt the functions using arrays (vertex arrays etc.). Extensions and shaders are not yet available.
This element is currently *experimental* and may change in future releases.
See Attributes Common to 3D Objects.
Name | Value Type | Default Value | Description | Comment | V. | Exp. |
---|---|---|---|---|---|---|
render_script |
empty |
OpenGL script to render the object. |
|
2.0 |
No | |
Exposed Actions | ||||||
Invalidate |
ref_type_action |
Requests the object to be re-rendered. |
2.0 |
2.0 |
Display simple 3D shapes with an OpenGL script defined in a separate file:
Skin file:
<?xml version="1.0" encoding="utf-8" ?> <SKIN background_color="#000000" text_color="#ffffff"> <!-- Custom 3D Viewer definition --> <DEFINE> <CUS_3D_VIEWER base_type="VIEW_3D" width="600" height="400" cursor="system::open_hand" y_ratio=".8" z_ratio=".5" transform.tz="-7" transform.ry="-45" transform.rx="-45"/> </DEFINE> <!-- Including the script file that defines the OpenGL rendering function--> <SCRIPT src="openGLShapes.cxx"/> <!-- The 3D Viewer --> <CUS_3D_VIEWER id="view3d"> <!-- Custom GL scripting object, calling the glRenderShapes function defined in openGLshapes.cxx--> <GL_OBJECT_3D id="view3d.shapes" render_script="glRenderShapes(this.opacity)"/> </CUS_3D_VIEWER> <!-- Force the engine to expose the view3d.shapes.opacity attribute, as it is not referenced elsewhere--> <EXPOSED_OBJECTS object_ids="view3d.shapes.opacity"/> </SKIN>
OpenGL script file (openGLShapes.cxx):