Transformation Pipeline Local (Object) Modeling W ld S Local (Object) Space Modeling transformation World Space Viewing transformation Eye Space Clip Space Projection transformation Perspective divide NDC space Viewport mapping Screen space l d d Normalized Device Coordinates
21
Embed
Transformation Pipeline - Computer Science and Engineeringweb.cse.ohio-state.edu/~wang.3602/courses/cse5542-2013-spring/10... · Transformation Pipeline Local (Object)Local (Object)
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Transformation Pipeline
Local (Object) Modeling W ld SLocal (Object)Space
Modelingtransformation
World Space
ViewingtransformationEye SpaceClip Space Projection
transformation
Perspectivedivide NDC space Viewport
mapping Screen spacel d dNormalized Device Coordinates
Coordinate system
A coordinate system is used to unambiguously represent a pointunambiguously represent a point
It contains a reference point (the origin) and three linearly independent vectorsand three linearly independent vectors (the basis)
v3
v1
v2
O
Screen Coordinate System
Glut
(0 0)OpenGL(0,0)
Screen Coordinate System
- 2D Regular Cartesian Grid- Origin (0,0) at lower leftOrigin (0,0) at lower left
corner (OpenGL convention)- Horizontal axis – x
Vertical axis yVertical axis – y - Pixels are defined at the grid
intersections (0,0)
y
- This coordinate system is defined relative to the display window origin(OpenGL: the lower left corner
x
(Ope G t e o e e t co eof the window) (2,2)
Local Coordinate System
Screen coordinate system is not very useful for displaying 3D objectsp y g j
You also do not necessarily know where the object is going to be placed in the end in the 3D world
Solution: define the positions of the vertices relative to its own center – Local coordinate system
yzyz
x x
Simple OpenGL code
void display() { glClearColor(0,0,1,1);
OpenGL 1.1 convention, the goal here is to show you the idea
More detail about what happens behind the scene glRotatef(45, 0,0,1);
glBegin(GL_TRIANGLES); //glBegin/End have been deprecated in OpenGL 3glColor4f(1,1,0,1); glVertex4f(vertices[0], vertices[1], vertices[2], vertices[3]); glVe te 4f( e ti e [4] e ti e [5] e ti e [6] e ti e [7])