PDA

View Full Version : Interleaved arrays??



dabeav
03-27-2002, 08:01 AM
Is it possible to display an indexed interleaved array?? If i have a gigantic interleaved array of verticies, texture coords, and normals, and an array of indexes. Can I use a function that will display it?? So far ive found that index arrays only work with vertices, is that true??

Bob
03-27-2002, 09:24 AM
Vertex arrays can contain vertex position, color, texture coordinate, normals, fog coordinare, and perhaps some more stuff. Whether you dereference this array using indices, or draw them as they are stored, is irrelevant. How they are stored physically in memory is also irrelevand (that is, separate or interleaved arrays). As long as you can specify the arrays using a start pointer, what part of a vertex it represent, the type of data stored, how many componets it contains, and the distance between two consecutive entries, you can use any of OpenGL's functions to draw the array.

dabeav
03-27-2002, 11:47 AM
Ok so say I have this setup

float vertexinfo[]=
{v1, v2, v3, t1, t2, n1, n2, n3,
v4, v5, v6, t3, t4, n4, n5, n6}

where v is the verticies, t is texture coords
n is normals, and so.

Then i have

int index[]=
{1, 2, 6, 3, 6, 4, 2}
etc.

i call glVertexPointer and point it to vertexinfo(only the parts i need)
i call glNormalPoint and do the same thing
and so on

Then i call glInterleavedArray and point it to index???

Bob
03-27-2002, 12:21 PM
I believe you have some things to learn concerning vertex arrays, like what the different commands do. Go read the Red Book (http://ask.ii.uib.no/ebt-bin/nph-dweb/dynaweb/SGI_Developer/OpenGL_PG/) , chapter two.

Basically, glInterleavedArray() is a wrapper for all the gl[Vertex|Normal|Color|TexCoord]Pointer() commands. You use one, and only one, of them to setup an array, never both. None of them draw anything, that is a job for glDrawElements/glDrawArrays, and similar commands.

dabeav
03-27-2002, 02:09 PM
BRAIN FART, i knew that you only use one at a time, god im so mentaly challenged. Sorry i was at work when i wrote that, inputting database quote AHHHHHHHHH. anywho thanks for the help...