PDA

View Full Version : Interleaving



Punchey
10-03-2000, 06:15 AM
What exactly is interleaving? I've heard this term used in conjunction with textures AND arrays of vertices. What exactly does this mean and how/why would I use it?

Bob
10-03-2000, 08:54 AM
Interleaved arrays are arrays that contains more that one kind of information. Lets say you have an array that holds data as folowing:

GLfloat interleaved_array[] = {x1, y1, z1, r1, g1, b1, x2, y2, z2, r2, g2, b2...};

Where z, y and z is coordinates, and r, g and b is the color. The number is just an index to say that all 1:s belong to the first vertex, and all 2:s belong to the second vertex.

In this case, you got an interleaved array containing verticex and colors. This is usefull when you store your data in such way as above. You don't have to worry about enabling/disabling the correct array when using "normal" vertex arrays, because this is automatically done by OpenGL.

You can also place texture coordinates, normals and edge flags in the array.

Punchey
10-05-2000, 05:21 AM
Thanks!