Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: Slow Texture Map (once again?)

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2002
    Location
    Toulouse, France
    Posts
    8

    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?)

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Jul 2001
    Posts
    533

    Re: Slow Texture Map (once again?)

    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.

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2002
    Location
    Toulouse, France
    Posts
    8

    Re: Slow Texture Map (once again?)

    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...

  4. #4
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,651

    Re: Slow Texture Map (once again?)

    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

  5. #5
    Junior Member Newbie
    Join Date
    Jun 2002
    Location
    Toulouse, France
    Posts
    8

    Re: Slow Texture Map (once again?)

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •