OGLRendering
[Desktop Automation]
A basic render context for generating 3D images that is not displayed anywhere. It is created with system:createoglcontext()
. The rendering object itself works with:
- models: individual meshes
- scenes: arrangements of models
Properties
None.
Methods
Name | Syntax | Description |
---|---|---|
addmodeltoscene | oglcontext:addmodeltoscene(modelid:integer); | Adds the model of 'modelID' to the current scene. |
createmodel | Modelid:integer = oglcontext:createmodel (mesh:mesh object, loadcolors: Boolean, loadtextures: Boolean, matrix: tluamatrix) | Puts a mesh object into the oglrender context, returns the modelID. loadcolors : optional, default true. Flag to allow loading of vertex colors. Setting this to false allows the setting of a uniform display color using setmodelcolor() . loadtextures : optional, default true. Enable loading of vertex textures. matrix : optional, transforms the model and sets the transformed bounding box when set. |
freemodel | oglcontext:freemodel(modelid:integer); | Removes model from scene and deletes reference |
lookatmodelfromsurroundingsphere | oglcontext:lookatmodelfromsurroundingsphere(modelid, eyex, eyey, eyez, upx, upy, upz, offset: float); | Sets the camera position. eyex …upz are vector components to describe position and orientation of the camera. Values get normalized and reduced to the necessary components, so, it is not necessary to calculate and specify a vector for up that is perfectly orthogonal to the resulting view ray from eye to the target. offset : distance to mesh object in multiples of bounding-box-enclosing sphere radii. For more information, search externally for OpenGL and eye and up vector. |
render | oglcontext:render(); | Renders the scene |
rotate | oglcontext:rotate(modelid:integer, angle:float radians); | Rotates the model under the camera (must be set up first with lookatmodelfromsurroundingsphere() ). Positive values produce rotations that make the part surface pass in opposite direction to the Up vector of the camera. |
savetobmp | oglcontext:savetobmp (filename:string, threaded:Boolean); | Saves current scene to BMP file as 'filename'. threaded : optional; when true, runs export in a separate thread. |
savetojpeg | oglcontext:savetojpeg(filename:string, quality:integer, threaded:Boolean); | Saves current scene to JPEG file as 'filename'. Quality: JPEG quality, default: 90. threaded : optional; when true, runs export in a separate thread. |
savetopng | oglcontext:savetopng(filename:string, threaded:Boolean); | Saves current scene to PNG file as 'filename'. threaded : optional; when true, runs export in a separate thread. |
setbackgroundcolor | oglcontext:setbackgroundcolor(r, g, b: integer 0-255); | Sets background color to RGB value |
setbackgroundgradient | oglcontext:setbackgroundgradient(ar, ag, ab, br, bg, bb, cr, cg, cb, dr, dg, db: integer 0-255); | ar …db : RBG values for bottom left, bottom right, top right, and top left corner of the OGL context, respectively |
setmodelcolor | oglcontext:setmodelcolor(modelid:integer, r, g, b, a:float) | Changes the uniform color of a model. To use this method, vertex colors must be disabled in the createmodel() call. |
setmodeltextureenabled | oglcontext:setmodeltextureenabled(textureenabled:Boolean) | Changes the textureendabled property |
setlightpos | oglcontext:setlightpos(x, y, z:float, type:integer); | Sets the position of lightsource, type 1 = point lightsource, otherwise unidirectional |
setreflectivity | oglcontext:setreflectivity (modelid: integer, reflectivity:float); | Sets the reflectivity factor (e.g. 0.6) for the model |
swapbuffers | oglcontext:swapbuffers(); | OpenGL glutswapbuffers function |
removemodelfromscene | oglcontext:removemodelfromscene (modelid:integer); | Removes model from scene |