Questions and Answers
Question 1
How did it arrive with the transformed coordinates?
The coordinates matrix is multiplied with the transformation matrix.
Question 2
What is/are the transformation(s) applied?
Translation and Scaling.
Question 3 -
OpenGL keeps track of only 1 matrix for transformation.
It will be tedious to do transformation for more than 1 mesh/
polygon/objects to different locations.
Why?
OpenGL can only take in 1 matrix for transformation.
If another matrix is to be added in, it overwrite the first one.
Question 4 -
(a) What is the current operation matrix after this function?
glTranslatef(10,2,4);
glScalef(5,5,5);
( 5 0 0 10 )
( 0 5 0 2 )
( 0 0 5 4 )
( 0 0 0 1 )
(b) What is the current operation matrix after this function?
glPushMatrix();
glRotatef(90,0,1,0);
( 5 0 0 10 )( 0 0 1 0 )=( 0 0 5 10 )
( 0 5 0 2 )( 0 1 0 0 )=( 0 5 0 2 )
( 0 0 5 4 )( -1 0 0 0 )=( -5 0 0 4 )
( 0 0 0 1 )( 0 0 0 1 )=( 0 0 0 1 )
(c) What is the current operation matrix after this function?
glPushMatrix();
glTranslate(2,2,2);
( 1 0 0 10 )( 0 0 5 2 )=( 0 0 5 12 )
( 0 1 0 2 )( 0 5 0 2 )=( 0 5 0 4 )
( 0 0 1 4 )( -5 0 0 2 )=( -5 0 0 6 )
( 0 0 0 1 )( 0 0 0 1 )=( 0 0 0 1 )
(d) What is the current operation matrix after this function?
glPopMatrix();
glScale(2,1,1);
( 0 0 5 10 )( 2 0 0 1 )=( 0 0 5 10 )
( 0 5 0 2 )( 0 1 0 1 )=( 0 5 0 2 )
( -5 0 0 4 )( 0 0 1 1 )=( -5 0 0 4 )
( 0 0 0 1 )( 0 0 0 1 )=( 0 0 0 1 )
(e) What is the current operation matrix after this function?
glPushMatrix();
glLoadIdentity();
glTranslate(0,5,0);
( 1 0 0 0 )( 0 0 0 0 )=( 1 0 0 0 )
( 0 1 0 0 )( 0 0 0 5 )=( 0 1 0 5 )
( 0 0 1 0 )( 0 0 0 0 )=( 0 0 1 0 )
( 0 0 0 1 )( 0 0 0 1 )=( 0 0 0 1 )
(f) What is the current operation matrix after this function?
glPopMatrix();
glPopMatrix();
glRotate(90,1,0,0);
(0 0 5 12)
(0 5 0 4)
(-5 0 0 6)
(0 0 0 1)
Question 5 -
What did you see? Screen shot it and explain why is the 2nd cube appeared at
(0,0,0)?
This is because OpenGL uses the previous matrix which is the first cube.
As it is at (5,0,0) minus 5 units in the x-direction would make the second cube appear at the origin.
Click HERE to download!!
Wednesday, November 21, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment