OpenGLContext.scenegraph.arraygeometry
Vertex-array-based geometry node for faces, lines and points
Classes
class ArrayGeometry(
object
):
Vertex-array-based geometry node for faces, lines and points
The ArrayGeometry class allows for rendering various
types of geometry using the vertex-array extensions of
OpenGL 1.1 and above.
The ArrayGeometry is a non-node-object used by the
IndexedFaceSet for rendering an array of triangle
vertices. Originally it also handled the PointSet
and IndexedLineSet. The ArrayGeometry object is
cached using the cache module, and regenerated if
the holding object changes field values or is
deleted.
__init__(
self
,
vertexArray
,
colorArray
= None
,
normalArray
= None
,
textureCoordinateArray
= None
,
objectType
= GL_TRIANGLES
,
startIndex
= 0
,
count
= -1
,
ccw
= 1
,
solid
= 1
)
Initialize the ArrayGeometry
- vertexArray
- array of vertex coordinates to drawcolorArray = None -- optional array of vertex colorsnormalArray = None -- optional array of normalstextureCoordinateArray = None -- optional array of texture coordinatesobjectType= GL_TRIANGLES -- type of primitive, see glDrawArrays. Allowed values are: GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP, GL_LINES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES, GL_QUAD_STRIP, GL_QUADS, and GL_POLYGON though few of those save points, lines and triangles have actually been tested. Only triangles is currently used.startIndex = 0 -- the index from which to draw, see glDrawArrayscount = -1 -- by default, render the whole array (len(vertexArray)), see glDrawArraysccw = 1 -- determines winding direction see glFrontFacesolid = 1 -- whether backspace culling should be enabled see glEnable( GL_CULL_FACE )
draw(
self
)
Does the actual rendering after the arrays are set up
At the moment, is a simple call to glDrawArrays
drawTransparent(
self
,
mode
)
Same as draw, but called when a transparent render is required
This uses triangleutilities and polygonsort to render
the polygons in view-depth-sorted order (back to front).
It does not provide for automatically tesselating
intersecting transparent polygons, so there will
be potential rendering artifacts.