When mapping textures to surfaces in OpenGL using the standard polygon method, you can do the following:
size = 10 glBegin(GL_POLYGON) glNormal3f(0.0, 0.0,-1.0) glTexCoord2f(0.0, 0.0); glVertex3f(0.0, 0.0, 0.0); glTexCoord2f(size, 0.0); glVertex3f(0.0, size, 0.0); glTexCoord2f(size, size); glVertex3f(0.0, size, size); glTexCoord2f(0.0, size); glVertex3f(0.0, 0.0, size); glEnd() However, I am using tesselation to render my surfaces, so my code looks like this:
gluTessBeginPolygon(self.tessellator, None) gluTessBeginContour(self.tessellator) for vertex in vertices: gluTessVertex(self.tessellator, vertex, vertex) gluTessEndContour(self.tessellator) gluTessEndPolygon(self.tessellator) Is there a function for gluTess that can be used to specify texture coordinates, like the glTexCoord2f function available for polygons that do not use tesselation?
Without specifying the texture coordinates, it seems like the color of the first pixel of the texture is chosen and then displayed over the entire surface, rather than actually displaying the texture.
0 comments:
Post a Comment