Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Interleaved arrays

This topic is 5813 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i just started working with vertex arrays and i decided an interleaved array would suit me best however, every tutorial on vertex arrays sets up vertices,normals,etc. using separate arrays are there any vertex array tutorials that explain interleaved arrays

Share this post

Link to post
Share on other sites
The glInterleavedArrays function simultaneously specifies and enables several interleaved arrays in a larger aggregate array.

void glInterleavedArrays(
GLenum format,
GLsizei stride,
const GLvoid *pointer
The type of array to enable. The parameter can assume one of the following symbolic values: GL_V2F, GL_V3F, GL_C4UB_V2F, GL_C4UB_V3F, GL_C3F_V3F, GL_N3F_V3F, GL_C4F_N3F_V3F, GL_T2F_V3F, GL_T4F_V4F, GL_T2F_C4UB_V3F, GL_T2F_C3F_V3F, GL_T2F_N3F_V3F, GL_T2F_C4F_N3F_V3F, or GL_T4F_C4F_N3F_V4F.
The offset in bytes between each aggregate array element.
A pointer to the first element of an aggregate array.
With the glInterleavedArrays function you can simultaneously specify and enable several interleaved color, normal, texture, and vertex arrays whose elements are part of a larger aggregate array element. For some memory architectures this is more efficient than specifying the arrays separately.

If the stride parameter is zero then the aggregate array elements are stored consecutively; otherwise stride bytes occur between aggregate array elements.

The format parameter serves as a key that describes how to extract individual arrays from the aggregate array:

If format contains a T, then texture coordinates are extracted from the interleaved array.
If C is present, color values are extracted.
If N is present, normal coordinates are extracted.
Vertex coordinates are always extracted.
The digits 2, 3, and 4 denote how many values are extracted.
F indicates that values are extracted as floating point values.
If 4UB follows the C, colors may also be extracted as 4 unsigned bytes. If a color is extracted as 4 unsigned bytes the vertex array element that follows is located at the first possible floating point aligned address.
If you call glInterleavedArrays while compiling a display list, it is not compiled into the list but is executed immediately.

You cannot include calls to glInterleavedArrays in glDisableClientState between calls to glBegin and the corresponding call to glEnd.

Note The glInterleavedArrays function is only available in OpenGL version 1.1 or later.

The glInterleavedArrays function is implemented on the client side with no protocol. Because the vertex array parameters are client-side state, they are not saved or restored by glPushAttrib and glPopAttrib. Use glPushClientAttrib and glPopClientAttrib instead

Share this post

Link to post
Share on other sites
there isn''t usually any speed difference in using interleaved arrays over seperated arrays...

the difference is, that when you setup your arrays seperatly, you set the data for each type (Verticies, normals, etc) to be read from potentially different places, whereas with an interleaved array, the data is such that it will go Vertex,Normal,Colour, Vertex,Normal,Colour, etc... where as seperate arrays go Vertex,Vertex,Vertex, and Normal,Normal,Normal, etc..

Overall though, interleaved arrays are somewhat useless, as seting up the arrays ''normally'' with a stride set (number of bytes between each bit of data) you can do exactly the same thing.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!