1 / 7

Introduction to OpenGL Transformations

Introduction to OpenGL Transformations. How does OpenGL View the Scene?. Since viewing transformation is applied after modeling transformation, you should define viewing transformation first in the modelview matrix

gayle
Download Presentation

Introduction to OpenGL Transformations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to OpenGL Transformations

  2. How does OpenGL View the Scene? • Since viewing transformation is applied after modeling transformation, you should define viewing transformation first in the modelview matrix • Viewing transformation sets up the camera position and orientation and maps coordinates from the world coordinate system to the viewing coordinate system. • The camera is located at the origin of the viewing coordinate system and faces the –z direction.

  3. How does OpenGL View the Scene?

  4. How does OpenGL View the Scene?

  5. Intuitive Camera Specification • How to specify a camera gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz). • (eyex, eyey, eyez): Coordinates of the camera (eye) location in the world coordinate system • (centerx, centery, centerz ): the look-at point, which should appear in the center of the camera image, specifies the viewing direction • (upx, upy, upz): an up-vector specifies the camera orientation by defining a world space vector that should be oriented upwards in the final image. • This intuitive specification allows us to specify an arbitrary camera path by changing only the eye point and leaving the look-at and up vectors untouched. • Or we could pan the camera from object to object by leaving the eye-point and up-vector fixed and changing only the look-at point.

  6. Example • void display() { glClear(GL_COLOR_BUFFER); glColor3f(0.0f, 1.0f, 0.0f); glLoadIdentity(); gluLookAt(0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); … others transform … glBegin(GL_TRIANGLES); glVertex3f(2.0f, 0.0f, 0.0f); glVertex3f(0.0f, 2.0f, 0.0f); glVertex3f(0.0f, 0.0f, 2.0f); glEnd(); glFlush(); } Xiaoyu Zhang, CSUSM

  7. Parallel (Orthographic) Projection • Set the viewing volume and matrix • glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(left, right, bottom, top, near, far); Xiaoyu Zhang, CSUSM

More Related