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

Started by
2 comments, last by rjpr 20 years, 2 months ago
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
YeTi
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
ok, tks anyway, i will think in a new strategy
YeTi
Clicky
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement