swetha
09-30-2009, 04:25 AM
Hello,
I am learning Opengl.I am confused with the view transformation and model transformation.
glLoadIdentity();
glTranslatef(0.0f,0.0f,-8.0f);
glBegin(GL_POLYGON);
glVertex3f(1.0f,0.0f,-8.0f);
glVertex3f(3.0f,0.0f,-8.0f);
glVertex3f(2.0f,2.0f,-8.0f);
glEnd();
I understood the above code as view transformation,setting the camera position at (0,0,-8) and viewing the triangle.
glBegin(GL_POLYGON);
glVertex3f(1.0f,0.0f,-8.0f);
glVertex3f(3.0f,0.0f,-8.0f);
glVertex3f(2.0f,2.0f,-8.0f);
glEnd();
glLoadIdentity();
glTranslatef(0.0f,0.0f,-8.0f);
I understand this as Model transformation,translating the object by (0,0,-8).
Both gives the same output. Have i understood correctly?
-swetha
I am learning Opengl.I am confused with the view transformation and model transformation.
glLoadIdentity();
glTranslatef(0.0f,0.0f,-8.0f);
glBegin(GL_POLYGON);
glVertex3f(1.0f,0.0f,-8.0f);
glVertex3f(3.0f,0.0f,-8.0f);
glVertex3f(2.0f,2.0f,-8.0f);
glEnd();
I understood the above code as view transformation,setting the camera position at (0,0,-8) and viewing the triangle.
glBegin(GL_POLYGON);
glVertex3f(1.0f,0.0f,-8.0f);
glVertex3f(3.0f,0.0f,-8.0f);
glVertex3f(2.0f,2.0f,-8.0f);
glEnd();
glLoadIdentity();
glTranslatef(0.0f,0.0f,-8.0f);
I understand this as Model transformation,translating the object by (0,0,-8).
Both gives the same output. Have i understood correctly?
-swetha