PDA

View Full Version : how to reuse vertices?



TB-Rex
03-12-2001, 11:57 AM
I have a mesh what contains everytime the same vertices and triangles. The Texture of the Triangles can change per triangle and also the position and color of the vertices.
Is there a way to reuse the vertices? Because of the changing textures I can't generate GL_TRIANGLE_STRIP's, I think I need a way to precache all vertices and use them per index or so.
I tried glVertexPointer(...) without success, it was slower than using glVertex3f(...); for all triangles (I can't draw elements baucause the different textures).

Now I am thinking about creating displaylists with the vertices and call them, I know it is stupit...thats the reason why I need help!

(if possible I need a hardware T&L frendly version :-) )

Deiussum
03-13-2001, 08:58 AM
It would probably be a good idea to sort your triangles by texture. For instance, draw all triangles that use texture1, then bind texture2, and draw all triangles that use that, etc... using this method you could use glDrawArrays and only pass the indices of vertices that use the current texture. Swapping textures a lot for each frame isn't usually a good idea. I can imagine that using a glBindTexture for each and every triangle could cause some major slowdown.