Solved

# Can someone explain stride to me? (VertexPointer)

Posted on 2004-09-19

void glVertexPointer(

GLint size,

GLenum type,

GLsizei stride,

const GLvoid *pointer

);

Parameters

size

The number of coordinates per vertex. The value of size must be 2, 3, or 4.

type

The data type of each coordinate in the array using the following symbolic constants: GL_SHORT, GL_INT, GL_FLOAT, and GL_DOUBLE.

stride

The byte offset between consecutive vertices. When stride is zero, the vertices are tightly packed in the array.

pointer

A pointer to the first coordinate of the first vertex in the array.

I find the definition of stride very vague. Could someone explain what it exactly means? For example, if i have an array of vertices... array { x, y, z, x, y, z, x, y, z } and the stride is set to 12 does this mean that if i call glArrayElement (1) it will draw the first set of x, y, z? (array[0], array[1], array[2])?

Or

does it mean the data is represented like this:

array { x, x, x, y, y, y, z, z, z }?

Thanks