gl.VertexPointer(vertexArray[, size])
gl.VertexPointer()
specifies an array of vertex coordinates to use when rendering. vertexArray
can be either a
one-dimensional table consisting of an arbitrary number of consecutive vertex coordinates or a two-dimensional table
consisting of an arbitrary number of subtables which contain 2 to 4 texture coordinates each. If vertexArray
is a
one-dimensional table, you need to pass the optional size
argument as well to define the number of vertex
coordinates per array element. size
must be a value in the range of 2 to 4. If vertexArray
is a two-dimensional table,
size
is automatically determined by the number of items in the first subtable, which must be in the range of
2 to 4 as well.
When using a two-dimensional table, please keep in mind that the number of vertex coordinates in each subtable must be constant. It is not allowed to use differing numbers of vertex coordinates in the individual subtables. The number of vertex coordinates is defined by the number of elements in the first subtable and all following subtables must use the very same number of coordinates.
If you pass Nil
in vertexArray
, the vertex coordinates array buffer will be freed but it won't be removed from
OpenGL. You need to do this manually, e.g. by disabling the vertex coordinates array or defining a new one.
In order to enable and disable a vertex array, call gl.EnableClientState() and
gl.DisableClientState() with the argument #GL_VERTEX_ARRAY
. If enabled,
the vertex array is used when gl.DrawArrays(), gl.DrawElements(),
or gl.ArrayElement() is called.
The vertex array is initially disabled and isn't accessed when gl.DrawArrays(), gl.DrawElements(), or gl.ArrayElement() is called.
Execution of gl.VertexPointer()
is not allowed between the execution of gl.Begin() and the corresponding execution
of gl.End(), but an error may or may not be generated. If no error is generated, the operation is undefined.
gl.VertexPointer()
is typically implemented on the client side.
Vertex array parameters are client-side state and are therefore not saved or restored by gl.PushAttrib() and gl.PopAttrib(). Use gl.PushClientAttrib() and gl.PopClientAttrib() instead.
Please consult an OpenGL reference manual for more information.
Nil
(see above)#GL_INVALID_VALUE
is generated if size
is not 2, 3, or 4.
#GL_VERTEX_ARRAY
gl.Get() with argument #GL_VERTEX_ARRAY_SIZE
gl.Get() with argument #GL_VERTEX_ARRAY_TYPE
gl.Get() with argument #GL_VERTEX_ARRAY_STRIDE
gl.GetPointer() with argument #GL_VERTEX_ARRAY_POINTER