Slow Texture Map (once again?)

Hello,
When Applying textures in the scene, the performances decrease awfully! I tried to do Tringle strip instead of triangles (as I read in this forum) but my code is made from a 3ds script (which I made and so I can change). This script returns an array for the faces containing the indices of the vertices in another array (also returned). so my display function is something like that:

glBegin(GL_TRIANGLES);
for(i=0;i<nb_faces;i++)
{
for(j=0;j<3;j++)
{
glTexCoord2f(tab_tv[tab_f[i][j]]);
glVertex3fv(tab_v[tab_f[i][j]);
}
}
glEnd();

So I had to make an orderd vector containing the indices of the vertex to be displayed thanks to GL_TRIANGLE_STRIP … but It’s very hard finding the order and I have many bugs…

I wonder if there isn’t another way to reorder the indices (Must I change my script… and how?) or maybe is there a totally different way to do?

Kek

PS: I’m not very good in english and I may have made few mistakes (I think incices is the plurar of index?)

You need to `stripify’ your mesh. Otherwise you are probably rendering each triangle as if it were a triangle strip, which obviously won’t be as quick as single triangles (degenerate case).

If you index the primitive by using glDrawElements (setting up your arrays of vertices, texture-coordinates and indices into the vertices for your triangles), you should get a significant performance increase (and you can get rid of your loop too!).

Hope this helps.

OK, but I’m afraid I know that: my problem is that I have a vertex array where some points are drawn several times (thanks to a face array) but if I want to use glDrawElement, I must initialise the vertex and texture array… and I will draw some points several times…
I’d love to find a way to know which vertices will be redrawn, to make a strip instead of several triangles… It should not be incompatible with glDrawElement!
Maybe I am a little optimistic?

Anyway, I thank you for answering…

Hi !
http://sourceforge.net/projects/actc/

ACTC is a very nice library that converts triangles into strips or fans, maybe that could help you.

Mikael

Well, I think that’s what I need…
I’ll see how it works, but I think (and hope) you solved my problem. Thanks a lot