Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

rjpr

different index arrays of vertex and normals possible with glDrawElements using VBO??

This topic is 5350 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, im a beginner and have to make an OBJ loader using octree and view frustum culling, its done now i have to use VBO, my problem is that i have different index arrays of vertex and normals, what i want to do is something like this glEnableClientState(GL_NORMAL_ARRAY); glDrawElements(GL_TRIANGLES,qtdAteMudar,GL_UNSIGNED_INT,indicesN); glDisableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_VERTEX_ARRAY); glDrawElements(GL_TRIANGLES,qtdAteMudar*3,GL_UNSIGNED_INT,indicesV); glDisableClientState(GL_VERTEX_ARRAY); but seems not to be possible in same frame make 2 times glDrawElements, any solution or i have to change the data of normals to be equal to the index of vertex??? tks and sorry for my english

Share this post


Link to post
Share on other sites
Advertisement
Nope, sorry, it doesn''t work that way. You set the various pointers, then call glDrawElements() only once. To do it properly, you need one entry in each array for every unique vertex. If a vertex has the same position but two different sets of UV coords for drawing two different faces, then in actuality you will need two unique vertices for that point, one for each set of UVs. The data for each component of the vertex needs to be at the same position in every array. Duplicate vertices if you have to.


Golem
Blender--The Gimp--Python--Lua--SDL
Nethack--Crawl--ADOM--Angband--Dungeondweller

Share this post


Link to post
Share on other sites

  • 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!