Computer Graphics. Transformations. CSC 470 Computer Graphics 1

Size: px
Start display at page:

Download "Computer Graphics. Transformations. CSC 470 Computer Graphics 1"

Transcription

1 Computer Graphics Transformations CSC 47 Computer Graphics 1

2 Today s Lecture Transformations How to: Rotate Scale and Translate 2

3 Introduction An important concept in computer graphics is Affine Transformations. Basically, these allow us to move objects around without deforming them. We will need to keep track of points and vectors as they do not transform in the same way. 3

4 Transformations One example of a transformation is the window to viewport transformation. Here we have seen an image in the world window scaled and translated (moved) into a viewport window. We will build on this transformation to allow us to move objects to more complex locations. 4

5 Transformations A Transformation consists of: a Rotation a Scaling and a Translation a Shearing They occur in 2D and 3D 5

6 Transformations Transformations allow for: 1. scene composition 6

7 Transformations Transformations allow for: 2. easily create symmetrical objects 7

8 Transformations Transformations allow for: 3. viewing objects at different angles 8

9 Transformations Transformations allow for: 4. computer animation where several objects need to move relative to one another 9

10 Transformations The OpenGL Pipeline OpenGL makes transformations easy. But that doesn t excuse you from learning about them. in detail!! 1

11 Transforming Points A transformation simply takes a point and maps it to another location. 11

12 Transforming Points In the 2D case this means. for P = (P( x, P y, 1) T and Q = (Q( x, Q y, 1) T P is at the location P = Pxi+Pyj + ξ (same for Q) then, Q = M (P x, P y, 1) T or Q = M(P) where M is some mapping matrix Q P 12

13 Transforming Points Exercise: if P = (3,4) and Q = (5, 7) what is M? (5,7,1) T = M (3,4,1) T We want to increase P x by 2 and increase P y by 3 what is M?? Q Q 1 x y = P P 1 x y 13

14 Affine Transformations As we have seen there are four types of transformations that can be combined to produce an affine transformation. We will look at these individually to begin 14

15 Translation Moving a point/object around in the x, y and/or z directions. In this example, the car does not rotate (it always remains upright) or scale in size. 15

16 Translation This means that values are being added or subtracted to the existing coordinates. dp x Q Q 1 x y = 1 1 dp dp 1 x y P P 1 x y Q P dp y 16

17 Translation Example: What is the translation matrix to move P=(4,6) to Q=(1,3)? Change in X = P Q Change in Y 17

18 18 18 Translation Translation Example: What is the Example: What is the translation matrix to move translation matrix to move P=(4,6,2) to Q=(1,3,5)? P=(4,6,2) to Q=(1,3,5)? P Q = Change in X Change in Y Change in Z

19 Scaling This means that the x,y and or z coordinates are being multiplied by a scalar. Q Q 1 x y = sp x sp y 1 P P 1 x y P 19

20 2 2 Scaling Scaling Example: What is the matrix that will scale a Example: What is the matrix that will scale a point P = (6,2) to Q = (3,4) point P = (6,2) to Q = (3,4) = P

21 21 21 Scaling Scaling Example: What is the matrix that will scale a Example: What is the matrix that will scale a point P = (6,2,9) to Q = (3,4,3) point P = (6,2,9) to Q = (3,4,3) = P

22 Rotation This means that the x,y and or z coordinates are rotated around a point. Q P Ө Ф P How do we calculate P rotating to Q? 22

23 Rotation Use right-angles and trig. We know: P(x,y) = (R cos(ф), R sin(ф) ) and Q(x,y) = (R cos(ө+ф), R sin(ө +Ф) ) y = R sin (Ф) From trigonometry we also know: cos(ө+ф) = cos(ө)cos(ф) sin(ө)sin(ф) sin(ө +Ф) = sin(ө)cos(ф) + cos(ө)sin(ф) x = R cos (Ф) 23

24 Rotation Use right-angles and trig. Q x = R cos(ө+ф) = R cos(ө)cos(ф) R sin(ө)sin(ф) Q y = R sin(ө +Ф) ) = R sin(ө)cos(ф) + R cos(ө)sin(ф) using P(x,y) = (R cos(ф), R sin(ф) ) we get Qx = P x cos(ө) P y sin(ө) Qy = P x sin(ө) + P y cos(ө) 24

25 25 25 Rotation Rotation This gives us the rotation matrix: This gives us the rotation matrix: = 1 1 ) cos( ) sin( ) sin( ) cos( 1 P P Q Q y x y x θ θ θ θ

26 Rotation What about 3D rotations? There are 3 types of 3D rotations: an x roll 26

27 Rotation What about 3D rotations? There are 3 types of 3D rotations: an x roll a y roll 27

28 Rotation What about 3D rotations? There are 3 types of 3D rotations: an x roll a y roll a z roll 28

29 29 29 Rotation Rotation A Z roll is the same A Z roll is the same as rolling in 2D as the as rolling in 2D as the object rolls between object rolls between the x and y axis. the x and y axis. = ) cos( ) sin( ) sin( ) cos( P P P Q Q Q z y x z y x θ θ θ θ Positive angle rotation occurs according to the right-hand rule!!!.

30 3 3 Rotation Rotation An X roll is a rotation between the y and z An X roll is a rotation between the y and z axes. axes. = ) cos( ) sin( ) sin( ) cos( 1 P P P Q Q Q z y x z y x θ θ θ θ

31 31 31 Rotation Rotation A Y roll is a rotation between the y and z axes. A Y roll is a rotation between the y and z axes. = ) cos( ) sin( 1 ) sin( ) cos( P P P Q Q Q z y x z y x θ θ θ θ

32 Shearing Shearing Shearing means that a point is dragged in a particular direction. This means that some coordinates are affected while others are not. 32

33 Shearing Shearing occurs along a line. In this example the shear occurs along the x axis. This gives us: Q x = P x + hpy; Q y = P y ; Q Q 1 x y = 1 h 1 1 P P 1 x y 33

34 Combining Transformations Rotation, Scaling, Translation and Shearing can be combined into the one matrix. For example, if you want to translate a shape, rotate it and then scale it, the transformation, T, would be: sp x sp y 1 cos( θ) sin( θ) sin( θ) cos( θ) dp dp 1 x y 34

35 Combining Transformations Transformation matrices are listed in reverse order and. Matrices are multiplied backwards. sp sp x y cos( θ) sin( θ) sp sp y x sin( θ) cos( θ) sp sp x y ( dp ( dp x x cos( θ) dp sin( θ) + dp 1 y y sin( θ)) cos( θ)) 35

36 Affine Transformations What we have been looking at are affine transformation. They have the following properties: Affine Transformations Preserve Affine Combinations of Points Affine Transformations Preserve Lines and Planes Affine Transformations Preserve Parallelism of Lines and Planes Relative Ratios are preserved The effect on areas can be predetermined. 36

37 Affine Transformations Affine Transformations Preserve Affine Combinations of Points. Given Q = a 1 P 1 + a 2 P 2 T(a 1 P 1 + a 2 P 2 ) = T(a 1 P 1 ) + T(a 2 P 2 ) 37

38 Affine Transformations Affine Transformations Preserve Affine Combinations of Points. Example: Show that point M which is the affine combination of.7*p(1,2) and.3*q(3,15) maintains the affine combination relationship when M, P and Q are transformed by the matrix, W:

39 Affine Transformations Affine Transformations Preserve Affine Combinations of Points. Example: Show that point M which is the affine combination of.7*p(1,2) and.3*q(3,15) maintains the affine combination relationship when M, P and Q are transformed by the matrix, W. [16,18.5,1] T =.7[1,2,1] T +.3[3,15] T WM =.7WP +.3WQ [49,41,1] T =.7[31,44,1] T +.3[91,34,1] T = [21.7, 3.8,.7] T + [27.3, 1.2,.3] T 39

40 Affine Transformations Affine Transformations Preserve Lines and Planes. preserves linearity and flatness lines stay as lines planes stay flat 4

41 Affine Transformations Affine Transformations Preserve Lines and Planes. Example: 41

42 Affine Transformations Affine Transformations Preserve Parallelism of Lines and Planes. if 2 parallel lines undertake the same transformation, they will remain parallel the same applies for planes. 42

43 Affine Transformations Relative Ratios are preserved - if P is a point some ratio of the way along a line, then after a transformation it will still be the same distance to line length ratio along the line. P t% P t% 43

44 Affine Transformations The effect on areas can be predetermined. area after transformation/area before transformation = det T Rotations and Translations do not affect areas or volumes. 44

45 Affine Transformations However, scaling does affect the area or volume. 45

46 Affine Transformations Example: If the volume of A is 1 units what will the volume of B be if B = T(A) where T = area(b)/area(a) ) = det T area(b) ) = det T * area(a) =.5 * 1 = B A 46

47 Affine Transformations How does this help us in computer graphics. An object will not lose its relative shape when transformed together. Objects will not lose their relative distances when transformed together. 47

48 Affine Transformations How does this help us in computer graphics. For example we can create a fly around of a scene where the whole scene is essentially being transformed. 48

49 Programming Affine Transformations OpenGL works with 4 dimensional matrices. However, you don t have to deal with them directly. OpenGL does all the hard work for you. 49

50 Programming Affine Take a green square produced with glrecti(-5, 5,- 5,5,5); Transformations 5

51 Programming Affine Now we can translate it with: gltranslated(5,5,); Transformations gltranslated(x,y,z); 51

52 Programming Affine or we can rotate it with: glrotate(3,,,1); Transformations glrotate(degrees,, x, y, z); 52

53 Programming Affine or we can scale it with: glscaled(.5,.5,1); Transformations glscaled(x,, y, z); 53

54 Programming Affine or we can combine them: Transformations glrotated(3,,,1); glscaled(.5,.5,1); gltranslated(5,5,); 54

55 Programming Affine Transformations And as we have to multiply the transformation matrices in reverse order we also have to specify them in reverse in OpenGL. E.g. To draw the rectangle which we translate, scale and then rotate the code is: glrotated(3,,,1); glscaled(.5,.5,1); gltranslated(5,5,); glrecti(-5, 5,-5,5,5); 5,5,5); 55

56 3D Programming At first it will seem complex, but its really quite easy. 56

57 3D Programming The OpenGL pipeline: modelview matrix, projection matrix, viewport matrix. 57

58 3D Programming Viewport Matrix set with glviewport() 58

59 3D Programming Projection Matrix set with glortho(left,, right, bottom, top, near, far) far near top left right bottom 59

60 3D Programming Modelview Matrix besides gltranslated, glscaled and glrotated glulookat(eye.x, eye.y, eye.z, lookat.x, lookat.y, lookat.z, up.x, up.y, up.z); eye position (x, y, z) up direction (which way is up?) 6

61 3D Programming void myinit() { glmatrixmode(gl_projection); glloadidentity(); glortho(-1, 1, -1, 1,, 2); glmatrixmode(gl_modelview); glloadidentity(); glulookat(1., 1., 1.,.,.,.,., 1.,.); } void main(int argc,, char **argv argv) { glutinitwindowsize(64,48); glutcreatewindow( 3D Window"); glutdisplayfunc(displaywire); glviewport(,, 64, 48); myinit(); glutmainloop(); } Set the Viewport Matrix Set the Projection Matrix Set the Modelview Matrix 61

62 3D Programming Elementary Shapes the following are drawn with the myinit() function set up thus: myinit() { } glmatrixmode(gl_projection); glloadidentity(); glortho(-1,1, 1,1,-1,1,,2); 1,1,,2); glmatrixmode(gl_modelview); glloadidentity(); glulookat(.,., 15.,.,.,.,., 1.,.); 62

63 3D Programming Elementary Shapes Wireframe Solids Cubes, Spheres etc 63

64 3D Programming glutwirecube(gldouble size); size is the length of a side 64

65 3D Programming glutwiresphere(gldouble radius, GLint slices, GLint stacks); slices are the vertical cuts (slices of cake), stacks are the horizontal cuts (stacks of pancakes) 65

66 3D Programming glutwiretorus(gldouble inrad, GLdouble outrad, GLint slices, GLint stacks); inrad is the centre radius, outrad is the outer radius 66

67 3D Programming glutwiretetrahedron(); unit in size (use glscaled to make bigger) 4 planes 67

68 3D Programming glutwireoctahedron(); unit in size (use glscaled to make bigger) 8 planes 68

69 3D Programming glutwiredodecahedron(); unit in size (use glscaled to make bigger) 1 planes 69

70 3D Programming glutwireicosahedron(); unit in size (use glscaled to make bigger) 2 planes 7

71 3D Programming glutwireicosahedron(); unit in size (use glscaled to make bigger) 2 planes 71

72 3D Programming And the best shape of them all. 72

73 3D Programming glutwireteapot(glfloat size); 73

74 Programming Affine Transformations We can also transform 3D objects such as the glutwireteapot(), thus: glrotated(3,,1,1); glscaled(.5,1.5,.2); gltranslated(1,5,); 74

75 3D Programming What about solid shapes? glutsolidsphere glutsolidcube etc. and you guessed it glutsolidteapot However, drawing these isn t as straight forward as the 2D shapes and the wireframes.. Lets look at the result of changing from glutwireteapot to glutsolidteapot in the previous program. 75

76 3D Programming What happened? Why can t we see a solid teapot? 76

77 3D Programming For many reasons, but in short LIGHTING!!! Without lighting, there are no: shadows or highlights These provide us with the illusion of depth and 3 dimensions. 77

78 3D Programming Lets turn on the lights. glenable() is used to turn many OpenGL features on.. One of these is lighting, thus: glenable(gl_lighting); this can be called in the main or the myinit when the window is being initialised. 78

79 3D Programming Now, what does the teapot look like? Not exactly the effect we were hoping for! So far we have enabled lighting, but we haven t actually turned any lights on!! 79

80 3D Programming We have to call glenable() again to turn on a light, thus: glenable(gl_light); There are a maximum of 8 lights you can use, GL_LIGHT, GL_LIGHT1,.., GL_LIGHT7 And the result. 8

81 3D Programming Better. But not great if you know what is possible with OpenGL. 81

82 3D Programming How can we improve this? First, we select a Shade Model. This is set using glshademodel(); There are two types of shading: GL_FLAT GL_SMOOTH 82

83 3D Programming glshademodel(gl_flat); 83

84 3D Programming glshademodel(gl_smooth); 84

85 3D Programming This improves the teapot s surface, but it still isn t quite right. There are parts of the teapot that shouldn t be displaying. e.g. the hidden parts. We need a depth test! glenable(gl_depth_test); 85

86 3D Programming glenable(gl_depth_test); 86

87 3D Programming glenable(gl_normalize); 87

88 3D Programming Initialisation of the drawing environment for 3D. main( int argc,, char **argv argv) { glutinit(&argc, argv); glutinitdisplaymode(glut_single GLUT_RGB GLUT_DEPTH ); glutinitwindowsize(screenwidth,, SCREENHEIGHT); glutinitwindowposition(1, 1); glutcreatewindow("solid"); "); glutdisplayfunc(displaysolid); glenable(gl_lighting); glenable(gl_light); glshademodel(gl_smooth); glenable(gl_depth_test); glenable(gl_normalize); glclearcolor(.1f,.1f,.1f,.f); glviewport(,, SCREENWIDTH, SCREENHEIGHT); glutmainloop(); } return 1; 88

89 3D Programming To display the teapot. This function is registered with mydisplayfunc(). void displaysolid(void) { glmatrixmode(gl_projection); glloadidentity(); glortho(-1, 1, -1, 1,.1, 1.); glmatrixmode(gl_modelview); glloadidentity(); glulookat(2.3,1.3,2,,.25,,.,1.,.); glclear(gl_color_buffer_bit GL_DEPTH_BUFFER_BIT); } glcolor3f(,1,); glpushmatrix(); gltranslated(.4,.5,.4); glrotated(3,,1,); glutsolidteapot(.5); glpopmatrix(); 89

90 3D Programming Positioning the Light lightposition = x, y, z, w GLfloat lightposition[]={2.f,3.f,3.f,.f}; gllightfv(gl_light, GL_POSITION, lightposition); 9

91 3D Programming lightposition[]={2.f,6.f,3.f,.f}; lightposition[]={1.f,2.f,4.f,.f}; 91

92 3D Programming Turning up the Lights lightintensity = red, green, blue, alpha GLfloat lightintensity[] = {.7f,.7f,.7f, 1.f}; gllightfv(gl_light, GL_DIFFUSE, lightintensity); 92

93 3D Programming lightintensity[] = {1.f, 1.f, 1.f, 1.f}; lightintensity[] = {.2f,.2f,.2f, 1.f}; 93

94 3D Programming lightintensity[] = {.2f, 1.f,.2f, 1.f}; lightintensity[] = {.2f,.f,.8f, 1.f}; 94

95 3D Programming Types of Light GL_AMBIENT scattered light, difficult to determine origin GL_DIFFUSE direct light with an origin GL_SPECULAR same as shininess, light comes from one direction and bounces off the surface 95

96 3D Programming Surface Colours Light can make an object appear in a different colour, but the actual colour of the object needs to be set differently. For this we use glmaterialfv() The material of an object can be ambient, diffuse and specular,, just as for light. It also has a factor of shininess. 96

97 3D Programming Surface Colours For example: GLfloat mat_ambient[]= {.5f,.8f,.6f, 1.f}; GLfloat mat_diffuse[] = {.6f,.8f,.6f, 1.f}; GLfloat mat_specular[] = {1.f,.8f, 1.f, 1.f}; GLfloat mat_shininess[] = {1.f}; glmaterialfv(gl_front,, GL_AMBIENT, mat_ambient); glmaterialfv(gl_front,, GL_DIFFUSE, mat_diffuse); glmaterialfv(gl_front,, GL_SPECULAR, mat_specular); glmaterialfv(gl_front,, GL_SHININESS, mat_shininess); 97

98 3D Programming Surface Colours 98

99 The End Next Two Weeks More about transformation Creating complex 3D shapes using polygon meshes 99

// double buffering and RGB glutinitdisplaymode(glut_double GLUT_RGBA); // your own initializations

// double buffering and RGB glutinitdisplaymode(glut_double GLUT_RGBA); // your own initializations #include int main(int argc, char** argv) { glutinit(&argc, argv); Typical OpenGL/GLUT Main Program // GLUT, GLU, and OpenGL defs // program arguments // initialize glut and gl // double buffering

More information

UNIT 7 LIGHTING AND SHADING. 1. Explain phong lighting model. Indicate the advantages and disadvantages. (Jun2012) 10M

UNIT 7 LIGHTING AND SHADING. 1. Explain phong lighting model. Indicate the advantages and disadvantages. (Jun2012) 10M UNIT 7 LIGHTING AND SHADING 1. Explain phong lighting model. Indicate the advantages and disadvantages. (Jun2012) 10M Ans: Phong developed a simple model that can be computed rapidly It considers three

More information

Graphics and Visualization

Graphics and Visualization International University Bremen Spring Semester 2006 Recap Representing graphic objects by homogenous points and vectors Using affine transforms to modify objects Using projections to display objects

More information

Introduction to OpenGL

Introduction to OpenGL Introduction to OpenGL Tutorial 1: Create a window and draw a 2D square Introduction: The aim of the first tutorial is to introduce you to the magic world of graphics based on the OpenGL and GLUT APIs.

More information

CSC Graphics Programming. Budditha Hettige Department of Statistics and Computer Science

CSC Graphics Programming. Budditha Hettige Department of Statistics and Computer Science CSC 307 1.0 Graphics Programming Department of Statistics and Computer Science Graphics Programming OpenGL 3D Drawing 2 3D Graphics Projections Getting 3D to 2D 3D scene 2D image 3 Projections Orthographic

More information

Introduction to OpenGL Transformations, Viewing and Lighting. Ali Bigdelou

Introduction to OpenGL Transformations, Viewing and Lighting. Ali Bigdelou Introduction to OpenGL Transformations, Viewing and Lighting Ali Bigdelou Modeling From Points to Polygonal Objects Vertices (points) are positioned in the virtual 3D scene Connect points to form polygons

More information

Books, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D

Books, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D Books, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D CS334 Spring 2012 Daniel G. Aliaga Department of Computer Science Purdue University Computer Graphics Pipeline Geometric Primitives

More information

Books, OpenGL, GLUT, CUDA, OpenCL, OpenCV, PointClouds, G3D, and Qt

Books, OpenGL, GLUT, CUDA, OpenCL, OpenCV, PointClouds, G3D, and Qt Books, OpenGL, GLUT, CUDA, OpenCL, OpenCV, PointClouds, G3D, and Qt CS334 Fall 2015 Daniel G. Aliaga Department of Computer Science Purdue University Books (and by now means complete ) Interactive Computer

More information

Precept 2 Aleksey Boyko February 18, 2011

Precept 2 Aleksey Boyko February 18, 2011 Precept 2 Aleksey Boyko February 18, 2011 Getting started Initialization Drawing Transformations Cameras Animation Input Keyboard Mouse Joystick? Textures Lights Programmable pipeline elements (shaders)

More information

Understand how real-world lighting conditions are approximated by OpenGL

Understand how real-world lighting conditions are approximated by OpenGL OpenGL Programming Guide (Addison-Wesley Publishing Company) Chapter 5 Lighting Chapter Objectives After reading this chapter, you ll be able to do the following: Understand how real-world lighting conditions

More information

Outline. Other Graphics Technology. OpenGL Background and History. Platform Specifics. The Drawing Process

Outline. Other Graphics Technology. OpenGL Background and History. Platform Specifics. The Drawing Process Outline 433-380 Graphics and Computation Introduction to OpenGL OpenGL Background and History Other Graphics Technology Drawing Viewing and Transformation Lighting GLUT Resources Some images in these slides

More information

Graphics and Computation Introduction to OpenGL

Graphics and Computation Introduction to OpenGL 433-380 Graphics and Computation Introduction to OpenGL Some images in these slides are taken from The OpenGL Programming Manual, which is copyright Addison Wesley and the OpenGL Architecture Review Board.

More information

Computer graphics MN1

Computer graphics MN1 Computer graphics MN1 http://www.opengl.org Todays lecture What is OpenGL? HowdoI useit? Rendering pipeline Points, vertices, lines, polygons Matrices and transformations Lighting and shading Code examples

More information

Lighting. Chapter 5. Chapter Objectives. After reading this chapter, you'll be able to do the following:

Lighting. Chapter 5. Chapter Objectives. After reading this chapter, you'll be able to do the following: Chapter 5 Lighting Chapter Objectives After reading this chapter, you'll be able to do the following: Understand how real-world lighting conditions are approximated by OpenGL Render illuminated objects

More information

CSC 470 Computer Graphics

CSC 470 Computer Graphics CSC 470 Computer Graphics Transformations of Objects CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 1 Transformations of objects - 2D CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 2 Using

More information

The Viewing Pipeline adaptation of Paul Bunn & Kerryn Hugo s notes

The Viewing Pipeline adaptation of Paul Bunn & Kerryn Hugo s notes The Viewing Pipeline adaptation of Paul Bunn & Kerryn Hugo s notes What is it? The viewing pipeline is the procession of operations that are applied to the OpenGL matrices, in order to create a 2D representation

More information

CS354 Computer Graphics Viewing and Modeling

CS354 Computer Graphics Viewing and Modeling Slide Credit: Donald S. Fussell CS354 Computer Graphics Viewing and Modeling Qixing Huang February 21th 2018 Computer Viewing There are three aspects of the viewing process, all of which are implemented

More information

Order of Transformations

Order of Transformations Order of Transformations Because the same transformation is applied to many vertices, the cost of forming a matrix M=ABCD is not significant compared to the cost of computing Mp for many vertices p Note

More information

Describe the Orthographic and Perspective projections. How do we combine together transform matrices?

Describe the Orthographic and Perspective projections. How do we combine together transform matrices? Aims and objectives By the end of the lecture you will be able to Work with multiple transform matrices Describe the viewing process in OpenGL Design and build a camera control APIs Describe the Orthographic

More information

C OMPUTER G RAPHICS Thursday

C OMPUTER G RAPHICS Thursday C OMPUTER G RAPHICS 2017.04.27 Thursday Professor s original PPT http://calab.hanyang.ac.kr/ Courses Computer Graphics practice3.pdf TA s current PPT not uploaded yet GRAPHICS PIPELINE What is Graphics

More information

Cheating: In case of cheating, all parts involved (source(s) and receiver(s)) get zero.

Cheating: In case of cheating, all parts involved (source(s) and receiver(s)) get zero. REGULATIONS Due date: 19.11.2009 Thursday 23:59 Late Submission: Late submission is not allowed. Submission: Use the COW system to submit your homework file. The homework should be done and submitted individually.

More information

Computer graphics MN1

Computer graphics MN1 Computer graphics MN1 http://www.opengl.org Todays lecture What is OpenGL? How do I use it? Rendering pipeline Points, vertices, lines,, polygons Matrices and transformations Lighting and shading Code

More information

Shading in OpenGL. Outline. Defining and Maintaining Normals. Normalization. Enabling Lighting and Lights. Outline

Shading in OpenGL. Outline. Defining and Maintaining Normals. Normalization. Enabling Lighting and Lights. Outline CSCI 420 Computer Graphics Lecture 10 Shading in OpenGL Normal Vectors in OpenGL Polygonal Shading Light Source in OpenGL Material Properties in OpenGL Approximating a Sphere [Angel Ch. 6.5-6.9] Jernej

More information

5.2 Shading in OpenGL

5.2 Shading in OpenGL Fall 2017 CSCI 420: Computer Graphics 5.2 Shading in OpenGL Hao Li http://cs420.hao-li.com 1 Outline Normal Vectors in OpenGL Polygonal Shading Light Sources in OpenGL Material Properties in OpenGL Example:

More information

Lecture 5: Viewing. CSE Computer Graphics (Fall 2010)

Lecture 5: Viewing. CSE Computer Graphics (Fall 2010) Lecture 5: Viewing CSE 40166 Computer Graphics (Fall 2010) Review: from 3D world to 2D pixels 1. Transformations are represented by matrix multiplication. o Modeling o Viewing o Projection 2. Clipping

More information

Computer Graphics (CS 4731) Lecture 11: Implementing Transformations. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Computer Graphics (CS 4731) Lecture 11: Implementing Transformations. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI) Computer Graphics (CS 47) Lecture : Implementing Transformations Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Objectives Learn how to implement transformations in OpenGL

More information

Visualizing Molecular Dynamics

Visualizing Molecular Dynamics Visualizing Molecular Dynamics Aiichiro Nakano Collaboratory for Advanced Computing & Simulations Department of Computer Science Department of Physics & Astronomy Department of Chemical Engineering & Materials

More information

Methodology for Lecture. Importance of Lighting. Outline. Shading Models. Brief primer on Color. Foundations of Computer Graphics (Spring 2010)

Methodology for Lecture. Importance of Lighting. Outline. Shading Models. Brief primer on Color. Foundations of Computer Graphics (Spring 2010) Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 11: OpenGL 3 http://inst.eecs.berkeley.edu/~cs184 Methodology for Lecture Lecture deals with lighting (teapot shaded as in HW1) Some Nate

More information

Introduction to OpenGL

Introduction to OpenGL Introduction to OpenGL Banafsheh Azari http://www.uni-weimar.de/cms/medien/cg.html What You ll See Today What is OpenGL? Related Libraries OpenGL Command Syntax B. Azari http://www.uni-weimar.de/cms/medien/cg.html

More information

yahoo.com

yahoo.com What is the workshop about? We use software such as AutoCAD, 3D Studio, Maya and many others for a host of applications ranging from Technical Drawings to Machine Design to Game Making to Special Effects

More information

Computer Graphics. Chapter 10 Three-Dimensional Viewing

Computer Graphics. Chapter 10 Three-Dimensional Viewing Computer Graphics Chapter 10 Three-Dimensional Viewing Chapter 10 Three-Dimensional Viewing Part I. Overview of 3D Viewing Concept 3D Viewing Pipeline vs. OpenGL Pipeline 3D Viewing-Coordinate Parameters

More information

Illumination Model. The governing principles for computing the. Apply the lighting model at a set of points across the entire surface.

Illumination Model. The governing principles for computing the. Apply the lighting model at a set of points across the entire surface. Illumination and Shading Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL computes illumination at vertices illumination Shading

More information

CSE 690: GPGPU. Lecture 2: Understanding the Fabric - Intro to Graphics. Klaus Mueller Stony Brook University Computer Science Department

CSE 690: GPGPU. Lecture 2: Understanding the Fabric - Intro to Graphics. Klaus Mueller Stony Brook University Computer Science Department CSE 690: GPGPU Lecture 2: Understanding the Fabric - Intro to Graphics Klaus Mueller Stony Brook University Computer Science Department Klaus Mueller, Stony Brook 2005 1 Surface Graphics Objects are explicitely

More information

Computer Graphics. Illumination and Shading

Computer Graphics. Illumination and Shading () Illumination and Shading Dr. Ayman Eldeib Lighting So given a 3-D triangle and a 3-D viewpoint, we can set the right pixels But what color should those pixels be? If we re attempting to create a realistic

More information

Illumination and Shading

Illumination and Shading Illumination and Shading Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL computes illumination at vertices illumination Shading

More information

Programming with OpenGL Part 3: Three Dimensions

Programming with OpenGL Part 3: Three Dimensions Programming with OpenGL Part 3: Three Dimensions Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Objectives Develop a more sophisticated

More information

Computer Graphics (Basic OpenGL)

Computer Graphics (Basic OpenGL) Computer Graphics (Basic OpenGL) Thilo Kielmann Fall 2008 Vrije Universiteit, Amsterdam kielmann@cs.vu.nl http://www.cs.vu.nl/ graphics/ Computer Graphics (Basic OpenGL, Input and Interaction), ((57))

More information

CS559: Computer Graphics. Lecture 12: OpenGL Li Zhang Spring 2008

CS559: Computer Graphics. Lecture 12: OpenGL Li Zhang Spring 2008 CS559: Computer Graphics Lecture 12: OpenGL Li Zhang Spring 2008 Reading Redbook Ch 1 & 2 So far: 3D Geometry Pipeline Model Space (Object Space) Rotation Translation Resizing World Space M Rotation Translation

More information

Modeling Transform. Chapter 4 Geometric Transformations. Overview. Instancing. Specify transformation for objects 李同益

Modeling Transform. Chapter 4 Geometric Transformations. Overview. Instancing. Specify transformation for objects 李同益 Modeling Transform Chapter 4 Geometric Transformations 李同益 Specify transformation for objects Allow definitions of objects in own coordinate systems Allow use of object definition multiple times in a scene

More information

Computer Graphics (CS 4731) Lecture 11: Implementing Transformations. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Computer Graphics (CS 4731) Lecture 11: Implementing Transformations. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI) Computer Graphics (CS 47) Lecture : Implementing Transformations Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Objectives Learn how to implement transformations in OpenGL

More information

CS559: Computer Graphics. Lecture 12: OpenGL Transformation Li Zhang Spring 2008

CS559: Computer Graphics. Lecture 12: OpenGL Transformation Li Zhang Spring 2008 CS559: Computer Graphics Lecture 2: OpenGL Transformation Li Zhang Spring 28 Today Transformation in OpenGL Reading Chapter 3 Last time Primitive Details glpolygonmode(glenum face, GLenum mode); face:

More information

Computer graphics Labs: OpenGL (1/3) Geometric transformations and projections

Computer graphics Labs: OpenGL (1/3) Geometric transformations and projections University of Liège Department of Aerospace and Mechanical engineering Computer graphics Labs: OpenGL (1/3) Geometric transformations and projections Exercise 1: Geometric transformations (Folder transf

More information

Transformation, Input and Interaction. Hanyang University

Transformation, Input and Interaction. Hanyang University Transformation, Input and Interaction Hanyang University Transformation, projection, viewing Pipeline of transformations Standard sequence of transforms Cornell CS4620 Fall 2008 Lecture 8 3 2008 Steve

More information

Fundamental Types of Viewing

Fundamental Types of Viewing Viewings Fundamental Types of Viewing Perspective views finite COP (center of projection) Parallel views COP at infinity DOP (direction of projection) perspective view parallel view Classical Viewing Specific

More information

COMP Computer Graphics and Image Processing. 5: Viewing 1: The camera. In part 1 of our study of Viewing, we ll look at ˆʹ U ˆ ʹ F ˆʹ S

COMP Computer Graphics and Image Processing. 5: Viewing 1: The camera. In part 1 of our study of Viewing, we ll look at ˆʹ U ˆ ʹ F ˆʹ S COMP27112 Û ˆF Ŝ Computer Graphics and Image Processing ˆʹ U ˆ ʹ F C E 5: iewing 1: The camera ˆʹ S Toby.Howard@manchester.ac.uk 1 Introduction In part 1 of our study of iewing, we ll look at iewing in

More information

Computer graphics MN1

Computer graphics MN1 Computer graphics MN1 Hierarchical modeling Transformations in OpenGL glmatrixmode(gl_modelview); glloadidentity(); // identity matrix gltranslatef(4.0, 5.0, 6.0); glrotatef(45.0, 1.0, 2.0, 3.0); gltranslatef(-4.0,

More information

Getting Started. Overview (1): Getting Started (1): Getting Started (2): Getting Started (3): COSC 4431/5331 Computer Graphics.

Getting Started. Overview (1): Getting Started (1): Getting Started (2): Getting Started (3): COSC 4431/5331 Computer Graphics. Overview (1): Getting Started Setting up OpenGL/GLUT on Windows/Visual Studio COSC 4431/5331 Computer Graphics Thursday January 22, 2004 Overview Introduction Camera analogy Matrix operations and OpenGL

More information

20 GLuint objects; 36 Scale += 0.1; 37 break; 38 case GLUT_KEY_DOWN:

20 GLuint objects; 36 Scale += 0.1; 37 break; 38 case GLUT_KEY_DOWN: 1 1. 1 #include 2 #include 3 Program 1 (OpenGL Sample016) 4 // 5 static int MouseX = 0; // X 6 static int MouseY = 0; // Y 7 static float SpinX = 0; // X 8 static float SpinY = 0;

More information

1 (Practice 1) Introduction to OpenGL

1 (Practice 1) Introduction to OpenGL 1 (Practice 1) Introduction to OpenGL This first practical is intended to get you used to OpenGL command. It is mostly a copy/paste work. Try to do it smartly by tweaking and messing around with parameters,

More information

DONALD HOUSE: CPSC 8170, FALL 2018 DESIGN OF A REAL-TIME ANIMATION PROGRAM

DONALD HOUSE: CPSC 8170, FALL 2018 DESIGN OF A REAL-TIME ANIMATION PROGRAM DONALD HOUSE: CPSC 8170, FALL 2018 DESIGN OF A REAL-TIME ANIMATION PROGRAM DEMO MODEL-VIEW-CONTROLLER DESIGN canonical.cpp The main program canonical.cpp acts as the controller, directing Model and actions

More information

SE313: Computer Graphics and Visual Programming. Computer Graphics Notes Gazihan Alankus, Fall 2011

SE313: Computer Graphics and Visual Programming. Computer Graphics Notes Gazihan Alankus, Fall 2011 SE313: Computer Graphics and Visual Programming Computer Graphics Notes Gazihan Alankus, Fall 2011 Computer Graphics Geometrical model on the computer -> Image on the screen How it works in your computer

More information

1 Transformations. Chapter 1. Transformations. Department of Computer Science and Engineering 1-1

1 Transformations. Chapter 1. Transformations. Department of Computer Science and Engineering 1-1 Transformations 1-1 Transformations are used within the entire viewing pipeline: Projection from world to view coordinate system View modifications: Panning Zooming Rotation 1-2 Transformations can also

More information

Lecture 4 Advanced Computer Graphics (CS & SE )

Lecture 4 Advanced Computer Graphics (CS & SE ) Lecture 4 Advanced Computer Graphics (CS & SE 233.420) Topics Covered Animation Matrices Viewing Lighting Animating Interactive Programs Consider planet.c Want to animate rotating the Earth around the

More information

Computer Graphics. Making Pictures. Computer Graphics CSC470 1

Computer Graphics. Making Pictures. Computer Graphics CSC470 1 Computer Graphics Making Pictures Computer Graphics CSC470 1 Getting Started Making Pictures Graphics display: Entire screen (a); windows system (b); [both have usual screen coordinates, with y-axis y

More information

CS4202: Test. 1. Write the letter corresponding to the library name next to the statement or statements that describe library.

CS4202: Test. 1. Write the letter corresponding to the library name next to the statement or statements that describe library. CS4202: Test Name: 1. Write the letter corresponding to the library name next to the statement or statements that describe library. (4 points) A. GLUT contains routines that use lower level OpenGL commands

More information

OpenGL. 1 OpenGL OpenGL 1.2 3D. (euske) 1. Client-Server Model OpenGL

OpenGL. 1 OpenGL OpenGL 1.2 3D. (euske) 1. Client-Server Model OpenGL OpenGL (euske) 1 OpenGL - 1.1 OpenGL 1. Client-Server Model 2. 3. 1.2 3D OpenGL (Depth-Buffer Algorithm Z-Buffer Algorithm) (polygon ) ( rendering) Client-Server Model X Window System ( GL ) GL (Indy O

More information

Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches:

Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches: Surface Graphics Objects are explicitely defined by a surface or boundary representation (explicit inside vs outside) This boundary representation can be given by: - a mesh of polygons: 200 polys 1,000

More information

Lectures OpenGL Introduction

Lectures OpenGL Introduction Lectures OpenGL Introduction By Tom Duff Pixar Animation Studios Emeryville, California and George Ledin Jr Sonoma State University Rohnert Park, California 2004, Tom Duff and George Ledin Jr 1 What is

More information

INF3320 Computer Graphics and Discrete Geometry

INF3320 Computer Graphics and Discrete Geometry INF3320 Computer Graphics and Discrete Geometry Visual appearance Christopher Dyken and Martin Reimers 23.09.2009 Page 1 Visual appearance Real Time Rendering: Chapter 5 Light Sources and materials Shading

More information

Graphics Programming

Graphics Programming Graphics Programming 3 rd Week, 2011 OpenGL API (1) API (application programming interface) Interface between an application program and a graphics system Application Program OpenGL API Graphics Library

More information

Basic Graphics Programming

Basic Graphics Programming 15-462 Computer Graphics I Lecture 2 Basic Graphics Programming Graphics Pipeline OpenGL API Primitives: Lines, Polygons Attributes: Color Example January 17, 2002 [Angel Ch. 2] Frank Pfenning Carnegie

More information

Rendering Pipeline/ OpenGL

Rendering Pipeline/ OpenGL Chapter 2 Basics of Computer Graphics: Your tasks for the weekend Piazza Discussion Group: Register Post review questions by Mon noon Use private option, rev1 tag Start Assignment 1 Test programming environment

More information

Lecture 4 of 41. Lab 1a: OpenGL Basics

Lecture 4 of 41. Lab 1a: OpenGL Basics Lab 1a: OpenGL Basics William H. Hsu Department of Computing and Information Sciences, KSU KSOL course pages: http://snipurl.com/1y5gc Course web site: http://www.kddresearch.org/courses/cis636 Instructor

More information

Drawing Primitives. OpenGL basics

Drawing Primitives. OpenGL basics CSC 706 Computer Graphics / Dr. N. Gueorguieva 1 OpenGL Libraries Drawing Primitives OpenGL basics OpenGL core library OpenGL32 on Windows GL on most unix/linux systems (libgl.a) OpenGL Utility Library

More information

API for creating a display window and using keyboard/mouse interations. See RayWindow.cpp to see how these are used for Assignment3

API for creating a display window and using keyboard/mouse interations. See RayWindow.cpp to see how these are used for Assignment3 OpenGL Introduction Introduction OpenGL OpenGL is an API for computer graphics. Hardware-independent Windowing or getting input is not included in the API Low-level Only knows about triangles (kind of,

More information

CS 148, Summer 2012 Introduction to Computer Graphics and Imaging

CS 148, Summer 2012 Introduction to Computer Graphics and Imaging http://www.ann.jussieu.fr/~frey/papers/scivi/cook%20r.l.,%20a%20reflectance%20model%20for%20computer%20graphics.pdf CS 148, Summer 2012 Introduction to Computer Graphics and Imaging f(~v 2 ) A 3 A 1 f(~v

More information

CS Computer Graphics: Illumination and Shading I

CS Computer Graphics: Illumination and Shading I CS 543 - Computer Graphics: Illumination and Shading I by Robert W. Lindeman gogo@wpi.edu (with help from Emmanuel Agu ;-) Illumination and Shading Problem: Model light/surface point interactions to determine

More information

CS Computer Graphics: Illumination and Shading I

CS Computer Graphics: Illumination and Shading I CS 543 - Computer Graphics: Illumination and Shading I by Robert W. Lindeman gogo@wpi.edu (with help from Emmanuel Agu ;-) Illumination and Shading Problem: Model light/surface point interactions to determine

More information

Transformations (Rotations with Quaternions) October 24, 2005

Transformations (Rotations with Quaternions) October 24, 2005 Computer Graphics Transformations (Rotations with Quaternions) October 4, 5 Virtual Trackball (/3) Using the mouse position to control rotation about two axes Supporting continuous rotations of objects

More information

CS 4204 Computer Graphics

CS 4204 Computer Graphics CS 4204 Computer Graphics 3D Viewing and Projection Yong Cao Virginia Tech Objective We will develop methods to camera through scenes. We will develop mathematical tools to handle perspective projection.

More information

Programming with OpenGL Part 2: Complete Programs Computer Graphics I, Fall

Programming with OpenGL Part 2: Complete Programs Computer Graphics I, Fall Programming with OpenGL Part 2: Complete Programs 91.427 Computer Graphics I, Fall 2008 1 1 Objectives Refine first program Alter default values Introduce standard program structure Simple viewing 2-D

More information

Modeling Objects by Polygonal Approximations. Linear and Affine Transformations (Maps)

Modeling Objects by Polygonal Approximations. Linear and Affine Transformations (Maps) Modeling Objects by Polygonal Approximations Define volumetric objects in terms of surfaces patches that surround the volume Each surface patch is approximated set of polygons Each polygon is specified

More information

Spring 2013, CS 112 Programming Assignment 2 Submission Due: April 26, 2013

Spring 2013, CS 112 Programming Assignment 2 Submission Due: April 26, 2013 Spring 2013, CS 112 Programming Assignment 2 Submission Due: April 26, 2013 PROJECT GOAL: Write a restricted OpenGL library. The goal of the project is to compute all the transformation matrices with your

More information

Lecture 3. Understanding of OPenGL programming

Lecture 3. Understanding of OPenGL programming Lecture 3 Understanding of OPenGL programming What is OpenGL GL: stands for Graphic Library Software interface for rendering purposes for 2D or 3D geometric data objects. Various Pieces gl: The basic libraries.

More information

Scientific Visualization Basics

Scientific Visualization Basics Scientific Visualization Basics Aiichiro Nakano Collaboratory for Advanced Computing & Simulations Dept. of Computer Science, Dept. of Physics & Astronomy, Dept. of Chemical Engineering & Materials Science,

More information

Graphics Hardware and OpenGL

Graphics Hardware and OpenGL Graphics Hardware and OpenGL Ubi Soft, Prince of Persia: The Sands of Time What does graphics hardware have to do fast? Camera Views Different views of an object in the world 1 Camera Views Lines from

More information

OpenGL for dummies hello.c #include int main(int argc, char** argv) { glutinit(&argc, argv); glutinitdisplaymode (GLUT_SINGLE GLUT_RGB); glutinitwindowsize (250, 250); glutinitwindowposition

More information

CSC 470 Computer Graphics. Three Dimensional Viewing

CSC 470 Computer Graphics. Three Dimensional Viewing CSC 470 Computer Graphics Three Dimensional Viewing 1 Today s Lecture Three Dimensional Viewing Developing a Camera Fly through a scene Mathematics of Projections Producing Stereo Views 2 Introduction

More information

Pearce Outline. OpenGL Background and History. Other Graphics Technology. Platform Specifics. The Drawing Process

Pearce Outline. OpenGL Background and History. Other Graphics Technology. Platform Specifics. The Drawing Process Outline 433-380 Graphics and Computation Introduction to OpenGL OpenGL Background and History Other Graphics Technology Drawing Viewing and Transformation Lighting JOGL and GLUT Resources Some images in

More information

GRAFIKA KOMPUTER. ~ M. Ali Fauzi

GRAFIKA KOMPUTER. ~ M. Ali Fauzi GRAFIKA KOMPUTER ~ M. Ali Fauzi Drawing 2D Graphics VIEWPORT TRANSFORMATION Recall :Coordinate System glutreshapefunc(reshape); void reshape(int w, int h) { glviewport(0,0,(glsizei) w, (GLsizei) h); glmatrixmode(gl_projection);

More information

Cameras (and eye) Ideal Pinhole. Real Pinhole. Real + lens. Depth of field

Cameras (and eye) Ideal Pinhole. Real Pinhole. Real + lens. Depth of field Cameras (and eye) Ideal Pinhole Real Pinhole Real + lens Depth of field 1 Z-buffer How do we draw objects? Polygon Based Fast Raytracing Ray/Object intersections Slow Copyright Pixar 2 Raytracing for each

More information

OpenGL. White Square Code 11/4/09. OpenGL. OpenGL. OpenGL

OpenGL. White Square Code 11/4/09. OpenGL. OpenGL. OpenGL OpenGL OpenGL OpenGL Is a mechanism to create images in a frame buffer Is an API to access that mechanism Is well specified OpenGL Is not a window system Is not a user interface Is not a display mechanism

More information

CSC 470 Computer Graphics

CSC 470 Computer Graphics CSC 47 Computer Graphics Three Dimensional Viewing Today s Lecture Three Dimensional Viewing Developing a Camera Fly through a scene Mathematics of Producing Stereo Views 1 2 Introduction We have already

More information

Computer Graphics Lighting

Computer Graphics Lighting Lighting 1 Mike Bailey mjb@cs.oregonstate.edu This work is licensed under a Creative Commons Attribution-NonCommercial- NoDerivatives 4.0 International License Lighting.pptx Why Do We Care About Lighting?

More information

Computer Graphics Lighting. Why Do We Care About Lighting?

Computer Graphics Lighting. Why Do We Care About Lighting? Lighting 1 Mike Bailey mjb@cs.oregonstate.edu This work is licensed under a Creative Commons Attribution-NonCommercial- NoDerivatives 4.0 International License Lighting.pptx Why Do We Care About Lighting?

More information

To Do. Computer Graphics (Fall 2008) Course Outline. Course Outline. Methodology for Lecture. Demo: Surreal (HW 3)

To Do. Computer Graphics (Fall 2008) Course Outline. Course Outline. Methodology for Lecture. Demo: Surreal (HW 3) Computer Graphics (Fall 2008) COMS 4160, Lecture 9: OpenGL 1 http://www.cs.columbia.edu/~cs4160 To Do Start thinking (now) about HW 3. Milestones are due soon. Course Course 3D Graphics Pipeline 3D Graphics

More information

Computer Graphics. Chapter 7 2D Geometric Transformations

Computer Graphics. Chapter 7 2D Geometric Transformations Computer Graphics Chapter 7 2D Geometric Transformations Chapter 7 Two-Dimensional Geometric Transformations Part III. OpenGL Functions for Two-Dimensional Geometric Transformations OpenGL Geometric Transformation

More information

CIS 636 Interactive Computer Graphics CIS 736 Computer Graphics Spring 2011

CIS 636 Interactive Computer Graphics CIS 736 Computer Graphics Spring 2011 CIS 636 Interactive Computer Graphics CIS 736 Computer Graphics Spring 2011 Lab 1a of 7 OpenGL Setup and Basics Fri 28 Jan 2011 Part 1a (#1 5) due: Thu 03 Feb 2011 (before midnight) The purpose of this

More information

Shading and Illumination

Shading and Illumination Shading and Illumination OpenGL Shading Without Shading With Shading Physics Bidirectional Reflectance Distribution Function (BRDF) f r (ω i,ω ) = dl(ω ) L(ω i )cosθ i dω i = dl(ω ) L(ω i )( ω i n)dω

More information

3D Graphics and API with OpenGL

3D Graphics and API with OpenGL 3D Graphics and API with OpenGL Human-Centered CAD Lab. 29-3-3 Contents 3D Graphics API & OpenGL Interactive Computer Graphics Example of OpenGL Programming Preparatory Simple code GLUT Functions Transformation

More information

COS340A Assignment 1 I Pillemer Student# March 25 th 2007 p1/15

COS340A Assignment 1 I Pillemer Student# March 25 th 2007 p1/15 COS340A Assignment 1 I Pillemer Student# 3257 495 9 March 25 th 2007 p1/15 Assignment 1 I Pillemer Student#: 3257 495 9 COS340A Date submitted: March 25, 2007 Question 1... p2 3 Question 2... p4 Question

More information

Duc Nguyen CSE 420 Computer Graphics 10/10/2018 Homework 1

Duc Nguyen CSE 420 Computer Graphics 10/10/2018 Homework 1 Duc Nguyen CSE 420 Computer Graphics 10/10/2018 Homework 1 1. The endpoints of a given line are (0, 0) and (18, 6). Compute the first 4 values of y manually using Bresenham's Line Algorithm as x steps

More information

Graphics Pipeline & APIs

Graphics Pipeline & APIs Graphics Pipeline & APIs CPU Vertex Processing Rasterization Fragment Processing glclear (GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT); glpushmatrix (); gltranslatef (-0.15, -0.15, solidz); glmaterialfv(gl_front,

More information

Today s class. Simple shadows Shading Lighting in OpenGL. Informationsteknologi. Wednesday, November 21, 2007 Computer Graphics - Class 10 1

Today s class. Simple shadows Shading Lighting in OpenGL. Informationsteknologi. Wednesday, November 21, 2007 Computer Graphics - Class 10 1 Today s class Simple shadows Shading Lighting in OpenGL Wednesday, November 21, 27 Computer Graphics - Class 1 1 Simple shadows Simple shadows can be gotten by using projection matrices Consider a light

More information

C++ is Fun Part 13 at Turbine/Warner Bros.! Russell Hanson

C++ is Fun Part 13 at Turbine/Warner Bros.! Russell Hanson C++ is Fun Part 13 at Turbine/Warner Bros.! Russell Hanson Syllabus 1) First program and introduction to data types and control structures with applications for games learning how to use the programming

More information

Illumination and Reflection in OpenGL CS 460/560. Computer Graphics. Shadows. Photo-Realism: Ray Tracing. Binghamton University.

Illumination and Reflection in OpenGL CS 460/560. Computer Graphics. Shadows. Photo-Realism: Ray Tracing. Binghamton University. Binghamton University EngiNet State University of New York EngiNet Thomas J. Watson School of Engineering and Applied Science WARNING All rights reserved. No Part of this video lecture series may be reproduced

More information

OpenGL & OpenGL ES. Young-Min Kang Tongmyong University. Tuesday, September 6, 11

OpenGL & OpenGL ES. Young-Min Kang Tongmyong University. Tuesday, September 6, 11 OpenGL & OpenGL ES Young-Min Kang Tongmyong University OpenGL Introduction OpenGL graphics library industrial standard platform independent features portability Introduction OpenGL graphics library industrial

More information

Programming using OpenGL: A first Introduction

Programming using OpenGL: A first Introduction Programming using OpenGL: A first Introduction CMPT 361 Introduction to Computer Graphics Torsten Möller Machiraju/Zhang/Möller 1 Today Overview GL, GLU, GLUT, and GLUI First example OpenGL functions and

More information

Affine Transformations in 3D

Affine Transformations in 3D Affine Transformations in 3D 1 Affine Transformations in 3D 1 Affine Transformations in 3D General form 2 Translation Elementary 3D Affine Transformations 3 Scaling Around the Origin 4 Along x-axis Shear

More information

Hierarchical Modeling: Tree of Transformations, Display Lists and Functions, Matrix and Attribute Stacks,

Hierarchical Modeling: Tree of Transformations, Display Lists and Functions, Matrix and Attribute Stacks, Hierarchical Modeling: Tree of Transformations, Display Lists and Functions, Matrix and Attribute Stacks, Hierarchical Modeling Hofstra University 1 Modeling complex objects/motion Decompose object hierarchically

More information