Jump to content
  • Advertisement
Sign in to follow this  
punmaster

OpenGL Rendering models from non-interleved arrays

This topic is 3328 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 have three separate arrays, one containing vertex positions (3f), one containing vertex normals (3f), and one containing texture coordinates (2f). Each face is made up of 9 total indices, one for each of the above arrays, times three points per (triangular) face. I want to render this data in OpenGL. All of the code I have seen uses one interleaved array to store all three vertex attributes (and consequently uses only 3 indices per face). Is it possible to have OpenGL render my data in its current form, or will I have to pre-process it to put it in interleaved form before OpenGL will touch it? I realize I could always just loop through the faces, manually de-index the arrays, and pass the data to OpenGL using direct vertex calls, but I was hoping for something a little more efficient. Can Vertex Buffer Objects (which I know very little about) be used in this case? Sorry for my ignorance, and thank you.

Share this post


Link to post
Share on other sites
Advertisement
Sure you can render from separate buffers, setting each gl*Pointer separately, with no stride. But OpenGL can't render using separate indices for each buffer. So preprocessing will be required so only one index buffer exists and can be passed to glDrawElements.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!