Advertisement Jump to content

C++ Index buffers

This topic is 457 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'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?

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!