Fundamentals of Computer Graphics Part 4

Slides:



Advertisements
Similar presentations
Computer Graphics - Transformation -
Advertisements

Figures based on regular polygons (lab3)
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Building Models modified by Ray Wisman Ed Angel Professor of Computer Science,
Informationsteknologi Wednesday, November 7, 2007Computer Graphics - Class 51 Today’s class Geometric objects and transformations.
Math 1Hofstra University – CSC171A1 Modeling Objects by Polygonal Approximations Define volumetric objects in terms of surfaces patches that surround the.
Math Foundations of CG Math 1 Hofstra University.
2/7/2001Hofstra University – CSC290B1 Review: Math (Ch 4)
Modeling Objects by Polygonal Approximations
CS5500 Computer Graphics March 22, Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Coordinate-Free Geometry When we learned simple.
2.1 si SI31 Advanced Computer Graphics AGR Lecture 2 Basic Modelling.
Transformations Objectives Understand how transformations work in 2D and 3D Understand the concept of homogenous coordinate system Understand scene graphs.
Objectives Learn to build arbitrary transformation matrices from simple transformations Learn to build arbitrary transformation matrices from simple transformations.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 OpenGL Transformations Ed Angel Professor of Computer Science, Electrical and Computer.
Chapter 3: Geometric Objects and Transformations Part 2
Transformations. 2 Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Coordinate-Free Geometry When we learned simple geometry, most of us.
2D Transformations. World Coordinates Translate Rotate Scale Viewport Transforms Hierarchical Model Transforms Putting it all together.
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
Graphics CSE 581 – Interactive Computer Graphics Mathematics for Computer Graphics CSE 581 – Roger Crawfis (slides developed from Korea University slides)
CS 480/680 Computer Graphics Representation Dr. Frederick C Harris, Jr. Fall 2012.
Transformations Dr. Amy Zhang.
OpenGL Matrices and Transformations Angel, Chapter 3 slides from AW, Red Book, etc. CSCI 6360.
TWO DIMENSIONAL GEOMETRIC TRANSFORMATIONS CA 302 Computer Graphics and Visual Programming Aydın Öztürk
Graphics Graphics Korea University kucg.korea.ac.kr Transformations 고려대학교 컴퓨터 그래픽스 연구실.
Geometric Transformations Jehee Lee Seoul National University.
Image Synthesis Rabie A. Ramadan, PhD 2. 2 Java OpenGL Using JOGL: Using JOGL: Wiki: You can download JOGL from.
Intro to 3D Models Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
PPT&Programs&Labcourse 1.
Geometric Objects and Transformation
Representation. Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames for.
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
Geometric Objects and Transformations
CAP 4730 Computer Graphic Methods Prof. Roy Levow Chapter 4.
Computer Graphics I, Fall 2010 OpenGL Transformations.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 OpenGL Transformations.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Affine Transformation. Affine Transformations In this lecture, we will continue with the discussion of the remaining affine transformations and composite.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Transformations Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Geometric Transformations Sang Il Park Sejong University Many slides come from Jehee Lee’s.
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
Learning Objectives Affine transformations Affine transformations Translation Translation Rotation Rotation Scaling Scaling Reflection Reflection Shear.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 73 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 73 Computer Graphics Three-Dimensional Graphics II.
Computer Graphics I, Fall 2010 Building Models.
1 OpenGL Transformations. 2 Objectives Learn how to carry out transformations in OpenGL ­Rotation ­Translation ­Scaling Introduce OpenGL matrix modes.
1 Geometric Transformations-II Modelling Transforms By Dr.Ureerat Suksawatchon.
Geometric Transformations. Transformations Linear transformations Rigid transformations Affine transformations Projective transformations T Global reference.
1 Geometric Transformations Modelling Transforms By Dr.Ureerat Suksawatchon.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
Graphics Graphics Korea University kucg.korea.ac.kr Geometric Primitives 고려대학교 컴퓨터 그래픽스 연구실.
4. Geometric Objects and Transformations
Modeling Transformations Mario Costa Sousa University of Calgary CPSC 453, Fall 2001 Mario Costa Sousa University of Calgary CPSC 453, Fall 2001.
OpenGL Matrices and Transformations Angel, Chapter 3 slides from AW, Red Book, etc. CSCI 6360/4360.
Unit-4 Geometric Objects and Transformations- I
Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009
OpenGL Transformations
OpenGL Transformations
OpenGL Transformations
Computer Graphics OpenGL Transformations
Introduction to Computer Graphics with WebGL
OpenGL Transformations
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Unit-5 Geometric Objects and Transformations-II
Geometric Transformations
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Transformations 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
Transformations in OpenGL
Geometric Objects and Transformations (II)
OpenGL Transformations
OpenGL Transformations
Presentation transcript:

Fundamentals of Computer Graphics Part 4 prof.ing.Václav Skala, CSc. University of West Bohemia Plzeň, Czech Republic ©2002 Prepared with Angel,E.: Interactive Computer Graphics – A Top Down Approach with OpenGL, Addison Wesley, 2001

Geometric Transformations Concentration on 3D graphics Affine & Euclidean vector spaces Homogeneous coordinates Formalities of vector spaces & matrix algebra – see App.B&C Goals: method for dealing with geometric objects – independent of a coordinate system coordinate free approach & homogeneous coordinates Fundamentals of Computer Graphics

Scalars, Points & Vectors Most geometric objects can be defined by a limited set of primitives, like scalars, points, vectors Different perspectives: mathematical programming geometric BUT ALL are important for understanding vector = directed (oriented) line segment vectors have no fixed position! Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Geometric View vectors have no fixed position had-to-tail rule – useful to express functionality C = A + B points & vectors – distinct geometric types! a given vector can be defined as from a fixed reference point (origin) to the given point p (dangerous vector repr.) Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Vector & Affine Spaces Vector (linear) space vector & scalars – addition &multiplication operations used to form a scalar field (scalars – real, complex numbers, rational functions – typical Ax=0, n-tuples etc.) Affine space – extension of vector space – the point is an object vector-point addition, point-point subtraction, geometric operations with points etc. Euclidean space – enables to measure distance, size Details see in the App.B & C Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Representation Mathematicians – scalars, points, vectors etc. – they are distinguished by symbols and fonts (bold, capital, italic etc.) Computer scientists – Abstract Data Types – ADT – set of operations on data; operations independent from the actual physical realization/implementation Data abstraction – fundamental to Computer Science but causes difficulties in a code understanding What is the meaning of a sequence in C++ : q = p + a * v; Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Representation What is the meaning of a sequence in C++ : q = p + a * v; can be determined if the definition is known: vector u, v; point p, q; scalar a, b; and their actual meaning must be vector type as a vector ! OpenGL is not object oriented so far Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Geometric ADT & Lines Symbols: , ,  - scalars P, Q, R – points u, v, w – vectors Typical geometrical operations: |  v| = |  | | v | v = P – Q => P = v + Q ( P – Q )+ ( Q – R ) = P – R P() = P0 +  d (a line in an affine space – param.form) Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Affine Sums new point P can be defined as P = Q +  v Point R v = R – Q and P = Q + (R –Q)= R + (1- )Q P = 1 R+  2 Q where 1 +  2 = 1 Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Convexity A convex object is one for which any point lying on the line segment connecting any two points in the object is also in the object P = 1 R+  2 Q & 1+ 2 = 1 More general form P = 1P1+2P2 +... +nPn where 1+2 +... +n= 1 & i  0 , i = 1, 2, ....,n Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Planes Let P, Q, R are points defining a plane in an affine space S() =  P + (1- )Q , 0   1 T() =  S + (1 - ) R , 0   1 using a substitution T(,) =  [ P + (1- )Q ] + ( 1 - ) R , 0   1 & 0   1 T(,) = P +  (1 -  )( Q – P ) + (1 - ) (R – P) Plane given by a point P0 and vectors u, v T(,) = P0 +  u +  v & 0  ,   1 Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Planes A triangle is defined as (a plane has no limits for ,  ) T(,) = P0 +  u +  v & 0 ,   1 If a point P lies in the plane then P - P0 =  u +  v Let w = u x v (cross product) The vector w is orthogonal to the plane and the equation wT (P – P0) = 0 (criterion for a test: point in the plane) vector w is called a normal vector and symbol n is often used Fundamentals of Computer Graphics

Three Dimensional Primitives Full range of graphics primitives cannot be supported by graphics systems – some are approximated most graphics systems optimized for procession points and polygons, polygons in E3 are not planar – tessellation is required or made by the system itself Constructive Solid Geometry (CSG) – objects build using set operations like union, intersection, difference etc. Fundamentals of Computer Graphics

Coordinate Systems and Frames A vector w is defined as w = 1v1 + 2v2 + 3v3 1, 2, 3 are components of w with respect to the basis vectors v1 ,v2 ,v3 (! toto jsou bázové vektory) vectors v forms coordinate system in vector space points representation needs to “fix” the origin – reference point and basis vectors are required - frame Fundamentals of Computer Graphics

Coordinate Systems and Frames Within a given frame every vector can be written uniquely as w = 1v1 + 2v2 + 3v3 just as in a vector space. v1 = [ 1, 0 , 0]T v2 = [ 0, 1 , 0]T v3 = [ 0, 0 , 1]T Every point can be written uniquely as w = P0 + 1v1 + 2v2 + 3v3 Fundamentals of Computer Graphics

Changes of Coordinate Systems Suppose that {v1 , v2 , v3 } & {u1 , u2 , u3 } are two basis vectors. Therefore 9 scalar components exist { ij} such as u = M v a vector w with respect to v = [v1 , v2 , v3 ]T a = [1 , 2 , 3 ]T w = aT v a vector w with respect to v = [u1 , u2 , u3 ]T b = [ß1 , ß2 , ß3 ]T w = bT u w = bT u = bT M v = aT v bT M = aT  a = MT b Fundamentals of Computer Graphics

Changes of Coordinate Systems The origin unchanged - rotation, scaling representation u = M v Simple translation or a change of a frame cannot be represented in this way Study change of representation – chapter 4.3.2 on your own Fundamentals of Computer Graphics

Homogeneous coordinates A point P located at (x,y,z) is represented using a 3D frame by P0, v1, v2, v3 as p = [ x , y , z ]T therefore P = P0 + x v1+ y v2 + z v3 and point P can be determined as P = 1v1 + 2v2 + 3v3 + P0 P = [1 , 2 , 3 , 1] [v1 , v2 , v3 , P0 ]T Every point can be written uniquely as w = P0 + 1v1 + 2v2 + 3v3 Fundamentals of Computer Graphics

Homogeneous Coordinates Suppose that {v1 , v2 , v3 , P0 }&{u1 , u2 , u3 , Q0 } are two basis vectors. Therefore 16 scalar components exist { ij} such as u = M v a vector w with respect to v = [v1 , v2 , v3 , P0 ]T  = [1 , 2 , 3 , 1]T w = aT v a vector w with respect to v = [u1 , u2 , u3 , Q0]T  = [ß1 , ß2 , ß3 , 1]T w = bT u w = bT u = bT M v = aT v bT M = aT  a = MT b Study Change in Frames and Frames&ADT Chapters 4.3.4.-5. on your own Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Frames in OpenGL Two frames – camera & world frames Consider the camera frame fixed model-view matrix converts the homogeneous coordinate representations of points and vectors to their representations in the camera frame the model-view matrix is part of the state of the system – there is always a camera frame and a present-world frame (how to define new frames – next chapters) three basis vectors correspond to up, y, z -directions, Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Frames in OpenGL Default settings: Camera & World frames the same Objects must moved away from camera or Camera must be moved away from objects If camera frame fixed & model-view positioning world frame to camera frame then model-view matrix A is defined as ( d- distance): Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Frames in OpenGL Moves points (x,y,z) in the world frame to (x,y,z,-d) in the camera frame This concept is better than the repositioning objects position by changing their vertices Setting the Model-View matrix by sending an array of 16 elements to glLoadMatrix User working in the world coordinates positions the objects as before Fundamentals of Computer Graphics

Modeling a Colored Cube Problem: Draw a rotating cube. Tasks to be done: modeling converting to the camera frame clipping projection hidden surfaces removal rasterization display of the object Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Modeling of a Cube Cube as 6 polygons – facets typedef GLfloat point3[3]; point3 vertices[8] = { {x,y,z},...{x,y,z}}; /* definition of the cube vertices */ ...... glBegin(GL_POLYGON); glVertex3fv(vertices[0]); glVertex3fv(vertices[3]); glVertex3fv(vertices[2]); glVertex3fv(vertices[1]); glEnd ( ); /* facet drawn */ outward facing - normal has right hand rule orientation Fundamentals of Computer Graphics

Data Structures for Object Represenation Advantages of the data structure: separation of topology and geometry geometry stored in the vertex list hg Fundamentals of Computer Graphics

Data Structures for Object Represenation typedef GLfloat point3[3]; point3 vertices [8] = {{x,y,z}, ... ,{x,y,z}}; /* vertices x,y,z coordinates def. */ GLfloat Colors[8][3] = {{r,g,b}, .... , {r,g,b}}; /* color defs. */ void quad(int a, int b, int c, int d) { glBegin(GL_QUADS); glColor3fv(colors[a]);glVertex3fv(vertices[a]); glColor3fv(colors[b]);glVertex3fv(vertices[b]); glColor3fv(colors[c]);glVertex3fv(vertices[c]); glColor3fv(colors[d]);glVertex3fv(vertices[d]); glEnd ( ); } Fundamentals of Computer Graphics

Data Structures for Object Representation color is specified - graphics system must decide how to fill bilinear interpolation C01() = (1- )C0+ C1 C23() = (1- )C2+ C3 for the given value  C01() = C4 , C23() = C5 C45() = (1- )C0+  C5 scan-line interpolation OpenGL provides this for others values that are assigned on the vertex-to-vertex basis void colorcube( );/*draws a cube*/ { quad(0,3,2,1); quad(2,3,7,6); quad(0,4,7,3); quad(1,2,6,5); quad(4,5,6,7); quad(0,1,5,4); } Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Vertex Arrays glBegin, glEnd, glColor, glVertex – high overhead Vertex arrays – a glEnableClientState(GL_COLOR_ARRAY); glEnableClientState(GL_VERTEX_ARRAY); Arrays are the same as before GLfloat vertices [ ] = {.........}; GLfloat colors [ ] = {.........}; /* specification where the arrays are */ glVertexPointer(3,GL_FLOAT,0,vertices); glColorPointer(3,GL_FLOAT,0,colors); /* 3D vector, type, continuous (packed), pointer to the array */ Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Vertex Arrays The facets must be specified GLubyte cubeIndices [24] = {0,3,2,1,2,3,7,6,0,4,7,3,1,2,6,5,4,5,6,7,0,1,5,4}; /* facets are formed by 4 vertices */ Options how to draw: glDrawElements(type,n,format,pointer); -------------- SOLUTION ------------ for ( i=0; i<6; i++) /* n number of elements */ glDrawElements(GL_POLYGON,4, GL_UNSIGNED_BYTE, &cubeIndicis[4*i]); or with a single call glDrawElements(GL_QUADS,24, GL_UNSIGNED_BYTE, &cubeIndices); Fundamentals of Computer Graphics

Affine Transformations Chapter 4.5 – study on your own Fundamentals of Computer Graphics

Rotation, translation and Scaling P’ = P + d Rotation x =  cos  y =  sin  x’ =  cos (+) y’ =  sin (+) Fundamentals of Computer Graphics

Rotation about a fixed point For rotation – implicit point origin 2D – simple 3D –complicated Transformation rigid-body non-rigid-body reflections Fundamentals of Computer Graphics

Transformation in Homogeneous Coordinates Translation Scaling Inversion operations: T-1 = T ( -x , -y , -z ) S-1 = S ( 1/x , 1/ y , 1/ z ) Fundamentals of Computer Graphics

Transformation in Homogeneous Coordinates Rotation in x-y plane Rotation in y-z plane Rotation in z-x plane R-1 () = R ( - ) = RT () Fundamentals of Computer Graphics

Transformations Concatenation well known strategy q = C B A p interpretation q = C (B (A p) ) Transformation q = M p Fundamentals of Computer Graphics

Rotation About a Fixed Point Rotation about the fixed point M = T(pf ) Rz(  ) T(- pf ) Fundamentals of Computer Graphics

Rotation About a Fixed Point Rotation about the fixed point M = T(pf ) Rz(  ) T(- pf ) Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Rotations in E3  Rxy Ryz  Cube can be rotated about all x, y, z axis In our case the transformation matrix is defined M = Rzx Ryz Rxy = Ry Rx Rz Rzx Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Rotations in E3 Transformation is defined by the instance transformation M M = T R S (order is substantial!) Each occurrence of an object in the scene is an instance of the object’s prototype To obtain proper size, location, orientation – instance transformation to the prototype is to be applied Fundamentals of Computer Graphics

Rotations About an Arbitrary Axis Given: points p1 , p2 and rotation angle  objects to be rotated Define vectors u = p1 - p2 and v = u / |u| - normalized v = [ x , y , z ]T x2 + y2 + z2 = 1 – directional cosines cos( x ) = x , cos( y ) = y , cos( z ) = z cos2( x ) + cos2( y ) + cos2 ( z ) = 1  only two directions angles are independent !! Fundamentals of Computer Graphics

Rotations About an Arbitrary Axis Transformation R = Rx(-x) Ry(-y) Rz() Ry(y) Rx(x) Fundamentals of Computer Graphics

Rotations About an Arbitrary Axis Object is moved to the origin Rotation about x axis Fundamentals of Computer Graphics

Rotations About an Arbitrary Axis Object is moved to the origin Rotation about y axis note the “-” position Complete transformation M = T(p0) Rx(-x) Ry(-y) Rz() Ry(y) Rx(x) T(- p0) Fundamentals of Computer Graphics

OpenGL Transformation Matrices Three matrices as a part of the state in OpenGL Only Model-View will be used CMT – current transformation matrix – can be changed by OpenGL functions – 4 x 4 size Supported operations: translation, scaling & rotation – last two with the fixed point in the origin C  I initialization C  CT translation C  CS scaling C  CR rotation Fundamentals of Computer Graphics

OpenGL Transformation Matrices Most systems allow to set directly or load or post-multiply the CMT with an arbitrary matrix M , scaling & rotation – last two with the fixed point in the origin C  M loading C  CM post-multiplication Fundamentals of Computer Graphics

OpenGL Transformation Matrices OpenGL model-view (GL_MODELVIEW) and projection (GL_PROJECTION) matrices (actually their product) are applied to ALL primitives – we should consider them as one CMT matrix – can be manipulated individually using glMatrixMode function glLoadMatrixf(pointer_to_matrix); /* vector of 16 position – column first order */ Fundamentals of Computer Graphics

OpenGL Transformation Matrices glLoadIdentity ( ); /* loads identity matrix */ glRotatef(angle, vx, vy, vz); /* f – float used */ /* specifies general rotation angle in degrees, v – specifies the vector – fixed point P0 is the origin */ glTranslatef(dx, dy, dz); /* translation */ glScalef ( sx, sy, sz); /* scaling */ Fundamentals of Computer Graphics

Rotation about a Fixed Point glMatrixMode(GL_MODELVIEW); glLoadIdentity ( ); glTranslatef(4.0, 5.0, 6.0); glRotatef(45.0, 1.0, 2.0, 3.0); glTranslatef(-4.0, -5.0, -6.0); /* rotates objects about the vector (1.0, 2.0, 3.0) with the angle 45° */ NOTE: we need not to form the rotation matrices as shown recently – try to make it on your own Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Transformation Order The sequence specified recently: C  I, initialization C  CT (4.0, 5.0, 6.0), translation C  CR (45.0, 1.0, 2.0, 3.0), rotation C  CT (-4.0, -5.0, -6.0), translation back in each step the CTM matrix is post-multiplied forming new CTM matrix C = T (4.0, 5.0, 6.0) R(45.0, 1.0, 2.0, 3.0) T (-4.0, -5.0, -6.0) Each vertex specified after the model-view matrix has been specified will be multiplied p’ = C p Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Spinning of the Cube Three callback functions: glutDisplayFunc(display); glutIdleFunc(spincube); glutMouseFunc(mouse); void display(void); /* visibility made by HW – GL_DEPTH.... */ {glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity ( ); glRotatef(theta[0];1.0, 0.0, 0.0); glRotatef(theta[1];0.0, 1.0, 0.0); glRotatef(theta[2];0.0, 0.0, 1.0); colorcube ( ); glutSwapBuffers ( ); /* swaps the buffers – drawing to the display */ } /* theta vector – global variable */ Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Spinning of the Cube void spincube ( ); { theta[axis] +=2.0; if (theta[axis] >360.0) theta[axis] -=360.0; glutPostRedisplay ( ); } void mouse (int btn, int state, int x, int y); { if (btn==GLUT_LEFT_BUTTON && state == GLUT_DOWN) axis=0; if (btn==GLUT_MIDDLE_BUTTON && state == GLUT_DOWN) axis=1; if (btn==GLUT_RIGHT_BUTTON && state == GLUT_DOWN) axis=2; } void mykey(char key, int mouse x, int mouse y); { if (key==‘q’ | | key==‘Q’ ) exit ( ); } /* simple termination */ Fundamentals of Computer Graphics

Loading, Pushing & Popping glLoadMatrixf(myarray); /* 4 x 4 matrix of floats -column first order from a vector */ glMultMatrixf(myarray); /* multiplies the current matrix by user specified matrix */ Sequence example GLfloat myarray [16]; for ( i=0; i<3; i++) for ( j=0; j<3; j++) myarray[4*j+i] = m[i][j]; Fundamentals of Computer Graphics

Loading, Pushing & Popping Sometimes it is reasonable to return the transformations back after they have been applied to some objects. Instead of re-computation the stack mechanism can be utilized glPushMatrix ( ); /* local transformation specifications */ glTranslatef ( .....); ................ /* DRAW OBJECTS HERE */ ................ /* recover recent state */ glPopMatrix ( ); Fundamentals of Computer Graphics

Interfaces to 3D Applications Study the Chapters 4.10 - 12 on your own Fundamentals of Computer Graphics

Fundamentals of Computer Graphics Conclusion Chapter 4 You have learnt in this chapter: how transformations are defined how can you use them how to construct quite complicated transformations Mention, please, that you are now capable to write quite complicated program with graphics output and input Next time we will learn how to represent different viewing principles, projections etc. Fundamentals of Computer Graphics