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
Texturing Triangle Strips
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.
If you only want to change texture coordinates drastically (not textures themselves) I would insert a degenerate triangle where you need it.
Do a google search for degenerate triangle strips to find more I guess.
Why you shouldn''t use iostream.h - ever! | A Good free online C++ book
Do a google search for degenerate triangle strips to find more I guess.
Why you shouldn''t use iostream.h - ever! | A Good free online C++ book
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement