View Full Version : matrix mode GL_TEXTURE usage

04-10-2002, 12:39 AM
i was trying to make spinning water by manipulating with matrix for texture projection and i faced some problems- after i do
glRotatef(angle, 0, 1, 0);
the drawn texture is rotated but around some other axis - my water are y-constant polys, and i simply wanted it to rotate around y-axis..
that means i think y for texture matrix is not the same as y for modelview matrix, am i right or i don't understand anything?
anyway i tried to find some tuts on different methods of manipulating texture matrix in OpenGL but i didn't succed

thx for any help

04-10-2002, 04:12 AM
When rotating a texture, you must rotate about the proper axis in texture coordinate space, not world space as when you rotate your geometry. If you map a 2D texture onto a surface, you specify texture coordinates along the axes S and T, and you should rotate about R (the third texture coordinate). Think about 2D geometry you specify along the X and Y axis on the screen. If you want to rotate it, you should rotate about the Z-axis, the axis pointing out from/in to the screen.

So to make the texture rotate on the surface, I believe you should rotate like this.

glRotatef(angle, 0, 0, 1); // rotate about (S, T, R) = (0, 0, 1)