glInterleavedArray

Does the following code shows the correct usage of the glInterleavedArray function?

How does the function know how many elements are there in the array?


typedef struct {

float	tx, ty;
float	nx, ny, nz;
float	x, y, z;

} VERTEX;

VERTEX vert[4];

glInterleavedArrays ( GL_T2F_N3F_V3F, 0, vert );

Yes, that’s correct. That part doesn’t draw the array, though. It just sets the pointer and format. To draw the array, you use glDrawArrays, glDrawElements, glArrayElement, etc.

For those drawing functions you specify indices into the array and length, so the glInterleavedArray function doesn’t need to know the length of the array at that point.