Archived

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

carb

Texturing Triangle Strips

Recommended Posts

I''ve recently converted over to triangle strips, and the gain in performance has obviously been worth it. But here''s the question: how the hell do I texture triangle strips? Here''s an example algorithm I have which goes through all the vertices in my terrain. This actually produces one strip for every "line" in my terrain ... Note that I keep my vertices in one array, but cycle through it as if it were two-dimensional.
      for (int i = 0; i < m_height - 1; i++) {
         glBegin(GL_TRIANGLE_STRIP);
            for (int j = 0; j < m_width - 1; j++) {
               DrawVertex[(i*m_width)+j];
               DrawVertex[((i+1)*m_width)+j]; // vertex above
            }
         glEnd();
      }
 
So how do I texture that? Obviously I could put a huge texture overtop with ease - but that''s not what I want. I mean, certain points will need to denote texture coords twice at that point (the end of a texture, beginning of another, etc.). Solutions? I''ve heard something about glTexGen ... but I''m not sure if that''s leading in the right direction. - Ben

Share this post


Link to post
Share on other sites