Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: Interleaved arrays??

  1. #1
    Member Regular Contributor
    Join Date
    Sep 2001
    Location
    macedon, ny
    Posts
    289

    Interleaved arrays??

    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??

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    Re: Interleaved arrays??

    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.

  3. #3
    Member Regular Contributor
    Join Date
    Sep 2001
    Location
    macedon, ny
    Posts
    289

    Re: Interleaved arrays??

    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???

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    Re: Interleaved arrays??

    I believe you have some things to learn concerning vertex arrays, like what the different commands do. Go read the Red Book , 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.

  5. #5
    Member Regular Contributor
    Join Date
    Sep 2001
    Location
    macedon, ny
    Posts
    289

    Re: Interleaved arrays??

    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...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •