Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In many of the OpenGL programs we have used this semester, object rotation was implemented using the following lines of code in the display callback:

In many of the OpenGL programs we have used this semester, object rotation was implemented using the following lines of code in the display callback:

glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glRotatef(xangle, 1.0, 0.0, 0.0); // rotate x glRotatef(yangle, 0.0, 1.0, 0.0); // rotate y glRotatef(zangle, 0.0, 0.0, 1.0); // rotate z

The parameters xangle, yangle, zangle are global variables that are initialized to zero. In the keyboard callback these global variables are incremented by 5 degrees when the user types X, Y, or Z and decremented by 5 degrees when the user types x, y, or z.

a) What will the three rotation angles be if the user types in XXXyyZxx?

b) What would happen if the user input xxZyyXXX instead? Explain.

c) Assuming there are no other changes to the GL_MODELVIEW matrix, what is the order

in which the three rotation operations above are applied to polygon vertices.

d) In general, does the order of operation matter when applying a sequence of rotations?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Systems Analysis And Synthesis Bridging Computer Science And Information Technology

Authors: Barry Dwyer

1st Edition

0128054492, 9780128054499

More Books

Students also viewed these Databases questions