mnfisher
11-03-2007, 01:05 AM
Hi,
I am new to opengl programming, and as an experiment wrote a simple "map" drawing program. Originally I used GL_QUADS and draw each map square with the same texture in turn to avoid multiple calls to glBindTexture.
However as an experiment I try to use a triangle strip (to draw a layer of the same texture). I can only get the first square to texture correctly - the second has a mirror of the texture
glBegin(GL_TRIANGLE_STRIP);
glTexCoord2f(0.1, 0.9); glVertex2i(0,200); //v0
glTexCoord2f(0.1, 0.1); glVertex2i(0, 0); //v1
glTexCoord2f(0.9, 0.9); glVertex2i(200,200); ///v2
glTexCoord2f(0.9, 0.1); glVertex2i(200,0); //v3
glTexCoord2f(0.9, 0.9); glVertex2i(400,200); //v4
glTexCoord2f(0.9, 0.1); glVertex2i(400, 0); //v5
glEnd();
So what is the correct way to texture a triangle (or quad) strip?
I am using Borland's Turbo C++(the new one), does any one know where I can download a copy of freeglut that is compatible?? I couldn't get coff2omf to work on the version I have..
Many thanks for any tips
Martin
I am new to opengl programming, and as an experiment wrote a simple "map" drawing program. Originally I used GL_QUADS and draw each map square with the same texture in turn to avoid multiple calls to glBindTexture.
However as an experiment I try to use a triangle strip (to draw a layer of the same texture). I can only get the first square to texture correctly - the second has a mirror of the texture
glBegin(GL_TRIANGLE_STRIP);
glTexCoord2f(0.1, 0.9); glVertex2i(0,200); //v0
glTexCoord2f(0.1, 0.1); glVertex2i(0, 0); //v1
glTexCoord2f(0.9, 0.9); glVertex2i(200,200); ///v2
glTexCoord2f(0.9, 0.1); glVertex2i(200,0); //v3
glTexCoord2f(0.9, 0.9); glVertex2i(400,200); //v4
glTexCoord2f(0.9, 0.1); glVertex2i(400, 0); //v5
glEnd();
So what is the correct way to texture a triangle (or quad) strip?
I am using Borland's Turbo C++(the new one), does any one know where I can download a copy of freeglut that is compatible?? I couldn't get coff2omf to work on the version I have..
Many thanks for any tips
Martin