PDA

View Full Version : Modelview question



starman
04-29-2003, 09:03 AM
I'm trying to fully understand the relationship between the "local" and
"grand, fixed" coordinate systems from Chapter 3 of the red book.
Relative to the grand, fixed coordinate system, where will the sphere be
drawn below?

// View transformations

glRotatef(90.0, 0, 1, 0);
glTranslatef(-10.0, 0.0, 0.0);

// Modeling transformations

glTranslatef(20.0, 0.0, 0.0);
gluSphere(...)

Looking at it as a local coordinate system that gets rotated 90 degrees,
the "local" positive X is the positive Z in the "grand, fixed" system.
This would put the sphere at (0.0, 0.0, 10.0) in the grand, fixed
system, correct?

Watcher
04-29-2003, 09:18 AM
Default coordinate system:



|+y
| / -z
| /
|/
-x ---------------- +x
/|
/ |
/ |
+z |-y


Rotate 90* around y:



|+y
| / +x
| /
|/
-z ---------------- +z
/|
/ |
/ |
-x |-y

The local +x axis is actually the same as the fixed -z axis. Translating -10 along x will move the view towards the screen ten units. Then translating the sphere 20 along x will move the sphere 20 units away from the screen. In "grand, fixed" coordinates the sphere would be at (0, 0, -10).

[This message has been edited by Watcher (edited 04-29-2003).]

starman
04-29-2003, 09:24 AM
Thanks! I had my rotation direction incorrect, but that's what I had in mind. This stuff is slowly starting to sink in...