Jump to content
  • Advertisement
Sign in to follow this  
akademiksqc

Dynamic calculation of GL_ARRAY_ELEMENTS

This topic is 2652 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

Hi,
** Sorry the title should say GL_ELEMENT_ARRAY_BUFFER instead of GL_ARRAY_ELEMENT

I have a simple cube generated by code, where the indices and vertices are hardcoded.
I coded a function to slice it...adjusting the vertices to fit the slice plane using VBO
I now have an issue...i can change the number of face depending on the way i slice the cube

Ex: I slice one of the cube's corner at 45 degrees, i now have a cube with 7 faces and 10 vertices instead of 6 faces and 8 vertices...

In that case, its easy for me to update/add the new vertices created by the new face but the hardcoded indices (GL_TRIANGLES)
does not match the cube's vertices anymore. I need an algorithm to dynamically adjust the GL_ELEMENT_ARRAY_BUFFER depending on the updated vertices.

Could someone point me in the right direction?
Thx.

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net 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!