Graphics.glDraw

From Moondust Wiki
Revision as of 16:55, 8 August 2016 by Kevsoft (talk | contribs)
Jump to navigation Jump to search

Graphics.glDraw is a function with access named arguments for drawing OpenGL primitives. The only required parameter is vertexCoords.

The list with accepted arguments:

Type Name Default Description
table vertexCoords <required> A flat table of x/y coordinates of verticies. Can be either 0-based or 1-based.
table textureCoords nil A flat table of x/y coordinates of for texture coordinates for each vertex. Can be either 0-based or 1-based.
table vertexColors nil A flat table of rgba values for the verticies.
table color {1.0, 1.0, 1.0, 1.0} (White) A table of RGB or RGBA values ranging from 0.0 to 1.0.
LuaImageResource or CaptureBuffer texture nil The texture to draw. Can be either a LuaImageResource or a CaptureBuffer.
number primitive Graphics.GL_TRIANGLES The OpenGL Graphics primative to draw verticies of. Valid options are: Graphics.GL_POINTS, Graphics.GL_LINES, Graphics.GL_LINE_LOOP, Graphics.GL_LINE_STRIP, Graphics.GL_TRIANGLES, Graphics.GL_TRIANGLE_STRIP, Graphics.GL_TRIANGLE_FAN
number priority 1.0 The priority to draw with. See LunaLua Render Priority.

Note: When using a CaptureBuffer as texture, be sure that the priority is higher than the one used in the buffer. Otherwise it might result into a crash.