Mirroring a texture

Started by
1 comment, last by HyperHacker 17 years, 6 months ago
Is there any way to mirror a texture across a polygon in OpenGL? Like if I have a texture which is just the left half of a tree, I want to apply this texture to a single quad mirrored to draw an entire tree, drawing the texture on the left and a mirror image of it on the right. I can't just use two quads because I'm just rendering pre-defined meshes and textures which do this.
---------------------------------dofile('sig.lua')
Advertisement
Yes, change the texture wrap modes

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
Thanks. I looked at a few OpenGL references and didn't see any mention of that.
---------------------------------dofile('sig.lua')

This topic is closed to new replies.

Advertisement