Archived

This topic is now archived and is closed to further replies.

OpenGL game programming->PlaneView

This topic is 5871 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I just bought the book yesterday and I have a question about the example code on page 120. It's a function for placing a "cockpit" in the world. What I find strange about this function is that it does the rotations in the order roll-yaw-pitch. Would that really work? Shouldn't it be yaw-pitch-roll? Here is the code:
    
void PlaneView(GLfloat planeX, GLfloat planeY, GLfloat planeZ,
               GLfloat roll, GLfloat pitch, GLfloat yaw)
{
   glRotatef(roll,  0.0f, 0.0f, 1.0f);
   glRotatef(yaw,   0.0f, 1.0f, 0.0f);
   glRotatef(pitch, 1.0f, 0.0f, 0.0f);

   glTranslatef(-planeX, -planeY, -planeZ);
}
     
Edited by - lowlevel on November 15, 2001 7:15:12 AM Edited by - lowlevel on November 15, 2001 7:15:56 AM

Share this post


Link to post
Share on other sites
This looks fine to me.

If this is your coordinate system...

Y
| /
|/
X---*---
/|
/ |
Z

Then the yaw, pitch and roll are accurate. If you are complaining about their order, well that doesnt really matter. You can do those rotations in any order since they are each on different axis.

Nitzan

-------------------------
www.geocities.com/nitzanw
www.scorchedearth3d.net
-------------------------

Share this post


Link to post
Share on other sites