moving over an infinite textured surface

Trying to simulate this effect by placing a stationary surface(centred at 0,0) and applying texture transforms to give the appearance of movement. I have set the original texture coordinates such that the texture origin lies at the centre of the surface. I can now happily rotate the texture to look in different directions. The problem is when I move forward. I am calculating what I think ought to be the correct translation in x and y to produce the desired effect but whilst the texture moves it doesnt move in the right direction so as to simulate a camera moving forward. Gettin desperate. Here is the relevent code. Any suggestions greatly appreciated.

if (direction == ‘l’) // left
theta = theta + 3 ;

if (direction ==‘r’) // right
theta = theta - 3 ;
if (direction == ‘f’) // forward
txinc = sin(0.0175theta) ;
tyinc = cos(0.0175
theta) ;
txpos = txpos + txinc ;
typos = typos + tyinc ;

glMatrixMode(GL_TEXTURE) ;
glLoadIdentity() ;

glTranslatef(txpos, typos, 0) ;
glRotatef(theta, 0.0,0.0, 1.0) ;
glMatrixMode(GL_MODELVIEW) ;

The results may be counter intuitive to you. Think about the actual numbers at the verts and which direction the texture appears to move in if you increase the numbers.

For example if I translate texture (+1, +1), the texture coordinates increase by (+1, +1), so (0, 0) becomes (1,1) If I’m looking at (0,0) as it increases to (1,1) the texture will appear to descend towards me not ascend away from me, because it’s the coordinate that gets translated up making the image appear to be transformed downwards.

Thanks for the help. I think I may be getting nearer to the source of the problem but no idea how to fix it. My experiments seem to show that the translation direction seems to reverse when the angle of rotation reaches a certain value. I think this is related to the fact that the texture is a repeating pattern. The frequency of the pattern seems to ‘interfere’ with the movement. I am experimenting with a 16*16 square chequerboard. So I get the situation where I have rotated the texture by a few degrees. Then I translate in y using the cosine formula. This works fine. However if I progressively increase the rotation then at some point the direction of movement of the texture reverses. I believe I need to adjust the y increments to take into account the texture repeat frequency but cannot get my head around how this might be done. My only idea at the moment is to change the original texture so that it only contains 4 squares. Since I would then have to repeat the texture anyway I am not sure that this would help.

Solved it (hooray). Thanks for the help