[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.8 Vertex arrays

Scheme version of APIs doesn't have GLenum type argument in C API, since Gauche-gl can figure out the type by passed vectors.

Scheme API of gl-*-array has offset optional argument, by which you can pass the GL the values beginning from the offset-th element of the passed uniform vector. This isn't in GL C API, since you can just offset the pointer in C.

NOTE: it is caller's responsibility to guarantee the passed vector has enough length. GL doesn't have an interface to specify the boundary, so Gauche can't detect an invalid length vector.

Function: gl-vertex-pointer size vec &optional stride offset

Sets the vertex array. Size specifies the number of scalar values per vertex (2, 3, or 4), and vec provides the actual value in either f32, f64, s32 or s16vector. Stride and offset can be used to tell GL to access vec sparsely.

Function: gl-normal-pointer vec &optional stride offset

Sets the normal array. Vec should be either a f32, f64, s32 or s16vector, where each consecutive triplet specifies a normal vector. Stride and offset can be used to tell GL to access vec sparsely.

Function: gl-color-pointer size vec &optional stride offset

Sets the color array. Size specifies the number of scalar values per color (3 or 4), and vec provides the actual values in either f32, f64, u32, u16, u8, s32, s16, or s8vector. Stride and offset can be used to tell GL to access vec sparsely.

Function: gl-index-pointer vec &optional stride offset

Sets the index array. Vec can be either s32, s16, u8, f32, or f64vector. Stride and offset can be used to tell GL to access vec sparsely.

Function: gl-tex-coord-pointer size vec &optional stride offset

Sets the texture coordinate array. Size specifies the number of scalar values per texture coordinate (1, 2, 3 or 4), and vec provides the actual values in either f32, f64, s32 or s16vector. Stride and offset can be used to tell GL to access vec sparsely.

Function: gl-edge-flag-pointer vec &optional stride offset

Sets the edge flag array. Vec must be a GL boolean vector. Stride and offset can be used to tell GL to access vec sparsely.

Function: gl-array-element ith

Dereference ith vertex information of the currently enabled arrays.

Function: gl-draw-elements mode indices

Issues geometric primitive calls consists of the vertex information of the currently enabled arrays, each of which is specified by indices, which should be either a u8, u16 or u32vector.

Mode is the same as of gl-begin.

Function: gl-draw-range-elements mode start end indices

[GL1.2] Like gl-draw-elements, but limits the range of indices between start and end, inclusive. GL driver may take advantage of the information for better performance.

Function: gl-draw-arrays mode first count

This is more straightforward. Starting from first index, count vertices is wrtten in the drawing mode mode (same as of gl-begin), taken from the current enabled arrays.

Function: gl-interleaved-arrays format vec &optional stride offset

Vec must be a f32vector. It contains various information (e.g. vertex position, color and texture coordinate) interleaved, in the way specified by format.

In Scheme API, we only allow uniform vector as vec, so you can't use the format that mixes float and integer, such as GL_C4UB_V2F.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by Shiro Kawai on June, 7 2008 using texi2html 1.78.