Skip to main content
GameDev.net gamedev.net
🔒 Locked

Index buffers

Started by SRaD Oct 21, 2017 at 10:14 PM 1 replies 1.3k views
Original Post
SRaD
SRaD

I've been learning how to do vertex buffers plus index buffers using Ogre, but I believe this is mostly the same across several engines. I have this question about using vertex buffers + index buffers.

Using DynamicGeometryGameState (from Ogre) as an example, I noticed that when drawing the cubes, they were programmatically drawn in order within the createIndexBuffer() function like so ...


        const Ogre::uint16 c_indexData[3 * 2 * 6] =
        {   
            0, 1, 2, 2, 3, 0, //Front face
            6, 5, 4, 4, 7, 6, //Back face
            
            3, 2, 6, 6, 7, 3, //Top face
            5, 1, 0, 0, 4, 5, //Bottom face
            
            4, 0, 3, 3, 7, 4, //Left face
            6, 2, 1, 1, 5, 6, //Right face
        };


From the above, the front face is drawn using the vertices 0, 1, 2, 2, 3, 0. But when reading in thousands of vertices from a file, one obviously doesn't code an array specifying which vertices make up a face.

So how is this done when working with a large number of vertices?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.