PDA

View Full Version : translation problem



coda
12-29-2003, 05:31 PM
I drew a 3D rect with length from -x to x. and on top of this rect ( in the middle) i drew a smaller rect of length -(x-w)/2 to (x-w)/2 where w < or equal to x. I want to translate this smaller rect to the left till it reach the edge whereby the edges of both rect are aligned properly so i translate by

glTranslatef ((-x-w)/2,0.0f,0.0f);

but when w=x, by right there should be no small rect showing but i get one face at the edge. Other than that it is okie, can someone point out my mistake?

mogumbo
12-30-2003, 07:50 AM
I don't understand the question. A screenshot would help.

zeckensack
12-30-2003, 08:10 AM
(-x-w) != -(x-w)

Try this:
glTranslatef(-(x-w)/2,0.0f,0.0f);