View Full Version : Scrollbars relative to screen not coordinates

05-17-2002, 01:07 AM
First, I want to thank everyone for spending time reading and perhaps answering this.
Im having the following problem, which Im trying to solve for weeks now:
I read-in a 3d file and display it and want to view it from any side, any place at any scale. glRotate and glScale are working fine, yet I have two scrollbars, which are supposed to move the object to the left/right/up/down. But not in absolute coordinates (e.g. like always adding 1 to the x value) but relative to its current position on the screen.
Example: I watch a building and click on "right" and the building moves to the right. Now I use glRotate and watch it from the other side, click on "right" and unluckily it moves to the left.
Please help!

05-17-2002, 05:57 AM
When you rotate the building, you need to also rotate the right vector. The best way of doing this will depend upon the particular degrees of freedom you are using.

05-17-2002, 10:26 PM
Perhaps you are calling glTranslate after glRotate? Try reversing them. Then the translate will be in the un-rotated coordinate system.