Transformation, Input and Interaction. Hanyang University

Size: px
Start display at page:

Download "Transformation, Input and Interaction. Hanyang University"

Transcription

1 Transformation, Input and Interaction Hanyang University

2 Transformation, projection, viewing

3 Pipeline of transformations Standard sequence of transforms Cornell CS4620 Fall 2008 Lecture Steve Marschner

4 Homogeneous Coordinate System Multiple geometric transformations such as translation, rotation scaling and perspective projection can be represented as a single matrix.

5 The transformation pipeline The modelview matrix transforms vertex data from the object coordinates to the eye coordinates. The eye coordinates are multiplied by the projection matrix to yield clip coordinates. The transformed vertex (x, y, z) is clipped by comparing with ±w. Perspective division normalizes the range of the vertex from -1 to 1 in all 3 axes. Normalized view volume The normalized device coordinates are scaled and translated in order to fit into the rendering screen(viewport transformation).

6 Matrix functions void glmatrixmode(glenum mode) glmatrixmode specifies the current operation matrix. mode GL_MODELVIEW» The matrix operations are applied to the modelview matrix stack. GL_PROJECTION» The matrix operations are applied to the projection matrix stack. GL_TEXTURE» The matrix operations are applied to the texture matrix stack.» This is used to transform the texture coordinates. void glloadidentity() This function loads the current matrix with the identity matrix. glmatrixmode(gl_modelview); glloadidentity();

7 Matrix functions void glloadmatrixf(const GLfloat *M) An arbitrary column-major matrix can be loaded into the current matrix by using this function. void glmultmatrixf(const GLfloat *M) The current matrix is multiplied with the 4x4 column-major matrix M and the result is stored into the current matrix. glmatrixmode(gl_modelview); float m[] = 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f ; glloadmatrixf(m); glmultimatrixf(m);

8 OpenGL matrices 4x4 column major matrices are used for 3D geometric transformation in OpenGL (homogeneous coordinate system). The current transformation matrix that is part of the state and is applied to all vertices that pass down the pipeline. The current transformation matrix is formed by multiplying together rotation, translation, and scaling matrices. 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.

9 Transformation functions void gltranslatef(glfloat dx, GLfloat dy, GLfloat dz) multiply the current matrix by a translation matrix. dx, dy, dz : the x, y, and z coordinates of a translation vector. C=C*T where C is the current matrix, T is the translation matrix void glscalef(glfloat sx, GLfloat sy, GLfloat sz) multiply the current matrix by a general scaling matrix. sx, sy, sz : scale factors along the x, y, and z axes, respectively. void glrotatef(glfloat angle, GLfloat x, GLfloat y, GLfloat z) multiply the current matrix by a rotation matrix. angle : the angle of rotation, in degrees. x, y, z : the x, y, and z coordinates of a vector (the axis of rotation)

10 Representing objects Objects represented as symbols Defined in model coordinates; transformed into world coordinates (M = TRS) glmatrixmode(gl_modelview); glloadidentity(); gltranslatef( ); glrotatef( ); glscalef( ); glutsolidcylinder( ); April 14,

11 Transformation functions The last matrix specified in the program is the first applied. glmatrixmode(gl_modelview); glloadidentity(); glrotatef(45.0, 0.0, 0.0, 1.0); gltranslatef(0.5, -0.5, 0.0); glutsolidcube(0.3); glmatrixmode(gl_modelview); glloadidentity(); gltranslatef(0.707, 0.0, 0.0); glrotatef(45.0, 0.0, 0.0, 1.0); glutsolidcube(0.3);

12 Example modelview transformation void MyDisplay() glclear(gl_color_buffer_bit); glviewport(0, 0, 300, 300); glmatrixmode(gl_modelview); // red rectangle glcolor3f(1.0, 0.0, 0.0); glloadidentity(); glutsolidcube(0.3); // green rectangle glcolor3f(0.0, 1.0, 0.0); glloadidentity(); glrotatef(45.0, 0.0, 0.0, 1.0); gltranslatef(0.6, 0.0, 0.0); glutsolidcube(0.3); // blue rectangle glcolor3f(0.0, 0.0, 1.0); glloadidentity(); gltranslatef(0.6, 0.0, 0.0); glrotatef(45.0, 0.0, 0.0, 1.0); glutsolidcube(0.3); glflush(); int main(int argc, char** argv) glutinitdisplaymode(glut_rgba); glutinitwindowsize(300, 300); glutcreatewindow("opengl Sample Drawing"); glclearcolor(1.0, 1.0, 1.0, 1.0); glmatrixmode(gl_projection); glloadidentity(); glortho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); glutdisplayfunc(mydisplay); glutmainloop(); return 0; The final appearance of scene or object depends on the order in which the transformations are applied.

13 Viewport and ortho glviewport glviewport specifies the area (viewport) within the window in actual screen coordinates that OpenGL can use to draw in. glviewport(glint x, GLint y, GLsizei width, GLsizei height); x, y : specifiy the lower left corner of the viewport rectangle. width, height : specify the width and height of the viewport. EX ) glutinitwindowsize(400, 300); glviewport(100, 80, 160, 100); 400 (window width) y = 80 origin x = 100 Viewport width = 160 heigh t = (window height)

14 Viewport and ortho glortho glortho sets the view cube for orthographic projection. glortho( axis GLdouble left, GLdouble right, // the range of the x- GLdouble bottom, GLdouble top, // the range of the y- axis axis ); GLdouble near, GLdouble far // the range of the z- Default setting : normalized view volume glortho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); (right, top, far) (left, bottom, near) vie w

15 Example source (glut) #include <gl/glut.h> void MyDisplay() glclear(gl_color_buffer_bit); glviewport(100, 100, 200, 200); glbegin(gl_quads); // red glcolor3f(1.0, 0.0, 0.0); glvertex3f(0, 0, 0.0); glvertex3f(640, 0, 0.0); glvertex3f(640, 480, 0.0); glvertex3f(0, 480, 0.0); // gray glcolor3f(0.5, 0.5, 0.5); glvertex3f(160, 120, 0.0); glvertex3f(480, 120, 0.0); glvertex3f(480, 360, 0.0); glvertex3f(160, 360, 0.0); glend(); glflush(); int main(int argc, char** argv) glutinitdisplaymode(glut_rgb); glutinitwindowsize(640, 480); glutinitwindowposition(0, 0); glutcreatewindow("opengl Drawing Example"); // Red, Green, Blue, Alpha glclearcolor(1.0, 1.0, 1.0, 1.0); glmatrixmode(gl_projection); // GL_MODELVIEW, GL_PROJECTION glloadidentity(); glortho(0.0, 640.0, 0.0, 480.0, -1.0, 1.0); glutdisplayfunc(mydisplay); glutmainloop(); return 0;

16 1 6 Input and Interaction Setting the area within the window and 3D space to draw. Setting various callback functions to make interactive programs, animations Reshape Callback Keyboard Callback SpecialKey Callback Mouse Callback Menu Callback Timer Callback

17 Example Source #include <gl/glut.h> GLint TopLeftX, TopLeftY, BottomRightX, BottomRightY; void MyDisplay() glviewport(0, 0, 300, 300); glclear(gl_color_buffer_bit); glcolor3f(0.5, 0.5, 0.5); glbegin(gl_polygon); glvertex3f(topleftx / 300.0, (300 - TopLeftY) / 300.0, 0.0); glvertex3f(topleftx / 300.0, (300 - BottomRightY) / 300.0, 0.0); glvertex3f(bottomrightx / 300.0, (300 - BottomRightY) / 300.0, 0.0); glvertex3f(bottomrightx / 300.0, (300 - TopLeftY) / 300.0, 0.0); glend(); glflush(); An example to draw a rectangle by clicking and dragging the left button of mouse

18 Example Source (cont d) void MyMouseClick(GLint Button, GLint State, GLint X, GLint Y) if(button == GLUT_LEFT_BUTTON && State == GLUT_DOWN) TopLeftX = X; TopLeftY = Y; void MyMouseMove(GLint X, GLint Y) BottomRightX = X; BottomRightY = Y; glutpostredisplay(); // marks the current window as needing to be redisplayed. int main(int argc, char** argv) glutinitwindowsize(300, 300); glutcreatewindow("opengl Drawing Example"); glclearcolor(1.0, 1.0, 1.0, 1.0); glmatrixmode(gl_projection); glloadidentity(); glortho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0); glutdisplayfunc(mydisplay); glutmousefunc(mymouseclick); glutmotionfunc(mymousemove); glutmainloop(); return 0;

19 glortho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0); => =>!= Map window coordinate into OpenGL coordinate v1x = TopLeftX / 300; v1y = (300 - TopLeftY) / 300; v2x = TopLeftX / 300; v2y = (300 - BottomRightY) / 300; v3x = BottomRightX / 300; v3y = (300 - BottomRightY) / 300; v4x = BottomRightX / 300; v4y = (300 - TopLeftY) / 300;

20 Compiling GLUT apps Linux (debian) sudo apt-get install freeglut3-dev Windows Download freeglut windows MSVC binary Mac sudo port install freeglut (or you can use brew instead) Use the CMakeLists.txt the same way as we compiled GLFW apps.

21 # -*- mode: cmake; -*- project(ogrefltk) CMakeLists.txt if(unix) set(cmake_c_flags_debug "$CMAKE_C_FLAGS_DEBUG -D_DEBUG -Wall") set(cmake_cxx_flags_debug "$CMAKE_CXX_FLAGS_DEBUG -D_DEBUG -Wall") else() include_directories( $OgreFltk_SOURCE_DIR/freeglut/include ) endif() add_executable(ogrefltk "practice3_1.cpp" ) if(unix) target_link_libraries(ogrefltk GL GLU glut ) else() target_link_libraries(ogrefltk OpenGL32.lib glu32.lib "$OgreFltk_SOURCE_DIR/lib/freeglut.lib" ) endif()

22 Matrix stacks OpenGL maintains stacks for each type of matrix. It is able to save the current transformation state and then restore it after some objects have been placed. It is useful for traversing hierarchical data structures (scene graph or tree) void glpushmatrix () Pushes the current matrix onto the stack. void glpopmatrix () Pops the matrix off the stack.

23 Example Solar system Solar system animation using timer callback function

24 Example Solar system (cont d) #include <gl/freeglut.h>jj #include <gl/glu.h> #include <gl/gl.h> static int Day = 0, Time = 0; void MyDisplay() glclear(gl_color_buffer_bit GL_DEPTH_BUFFER_BIT); glenable(gl_depth_test); glmatrixmode(gl_modelview); glloadidentity(); gltranslatef(0.0, 0.0, -2.0); /***The earth***/ glpushmatrix(); // 지구의공전 glrotatef((float)day, 0.0, 1.0, 0.0); gltranslatef(0.7, 0.0, 0.0); // 지구의자전 glrotatef((float)time, 0.0, 1.0, 0.0); glcolor3f(0.5, 0.6, 0.7); glutsolidsphere(0.1, 30, 8); /***The moon***/ glpushmatrix(); // 달의공전 glrotatef((float)time, 0.0, 1.0, 0.0); gltranslatef(0.2, 0.0, 0.0); glcolor3f(0.9, 0.8, 0.2); glutsolidsphere(0.04, 30, 8); glpopmatrix(); glpopmatrix(); /***The sun***/ glcolor3f(1.0, 0.3, 0.4); glutsolidsphere(0.2, 30, 16); glutswapbuffers(); void MyTimer(int value) Day = (Day + 10) % 360; Time = (Time + 5) % 360; gluttimerfunc(100, MyTimer, 1); glutpostredisplay(); int main(int argc, char** argv) glutinit(&argc, argv); glutinitdisplaymode(glut_double GLUT_RGB GLUT_DEPTH); glutinitwindowsize(500, 500); glutcreatewindow("solar system"); glclearcolor(0.0, 0.0, 0.0, 0.0); glmatrixmode(gl_projection); glloadidentity(); glortho(-1.0, 1.0, -1.0, 1.0, -1.0, 3.0); glutdisplayfunc(mydisplay); gluttimerfunc(100, MyTimer, 1); glutmainloop(); return 0;

25 Example - Rotate an object using mouse

26 #include <gl/glut.h> bool bdrag = false; float g_fdistance = f; float g_fspinx = 0.0f; float g_fspiny = 0.0f; int ptlastmousepositx, ptlastmouseposity; int ptcurrentmousepositx, ptcurrentmouseposity; void ChangeSize(GLsizei width, GLsizei height) GLfloat faspect = (GLfloat)width/(GLfloat)height; GLfloat nrange = height/4.0; if(height == 0) height = 1; glviewport(0, 0, width, height); glmatrixmode(gl_projection); glloadidentity(); if (width <= height) glortho (-nrange, nrange, -nrange/faspect, nrange/faspect, -nrange*4.0f, nrange*4.0f); else glortho (-nrange*faspect, nrange*faspect, -nrange, nrange, -nrange*4.0f, nrange*4.0f); glmatrixmode(gl_modelview); glloadidentity(); void MyMouseClick(GLint Button, GLint State, GLint X, GLint Y) if(button == GLUT_LEFT_BUTTON ) if (State == GLUT_DOWN) ptlastmousepositx = ptcurrentmousepositx = X; ptlastmouseposity = ptcurrentmouseposity = Y; bdrag = true; else if (State == GLUT_UP) bdrag = false;

27 void MyMouseMove(GLint X, GLint Y) ptcurrentmousepositx = X; ptcurrentmouseposity = Y; if( bdrag ) g_fspinx -= (ptcurrentmousepositx - ptlastmousepositx); g_fspiny -= (ptcurrentmouseposity - ptlastmouseposity); ptlastmousepositx = ptcurrentmousepositx; ptlastmouseposity = ptcurrentmouseposity; glutpostredisplay(); void RenderScene(void) glclear(gl_color_buffer_bit GL_DEPTH_BUFFER_BIT); glpushmatrix(); gltranslatef(0.0f, 0.0f, g_fdistance); glrotatef( -g_fspiny, 1.0f, 0.0f, 0.0f ); glrotatef( -g_fspinx, 0.0f, 1.0f, 0.0f ); glcolor3f(0.0f, 1.0f, 0.0f); glutwireteapot(100.0); glpopmatrix(); glutswapbuffers(); int main(int argc, char *argv[]) glutinit(&argc, argv); glutinitdisplaymode(glut_double GLUT_RGB GLUT_DEPTH); glutinitwindowsize(600, 600); glutcreatewindow( Rotate an object using mouse"); glutreshapefunc(changesize); glutmousefunc(mymouseclick); glutmotionfunc(mymousemove); glutdisplayfunc(renderscene); glutmainloop(); return 0;

28 Orthographic projection Projectors are orthogonal to projection surface. void glortho(gldouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble znear, GLdouble zfar) frustum far plane near plane image plane

29 Perspective projection Projectors converge at center of projection. frustum near plane far plane viewpoint image plane

30 Perspective projection void glfrustum(gldouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble znear, GLdouble zfar) void gluperspective(gldouble fovy, GLdouble aspect, GLdouble znear, GLdouble zfar)

31 Example orthogonal and perspective projections Orthogonal projection Perspective projection

32 Example orthogonal and perspective projections (cont d) #include <gl/glut.h> static GLfloat xrot = 0.0f; static GLfloat yrot = 0.0f; static int width, height; bool bperspective = true; void SetProjection() GLfloat faspect = (GLfloat)width/(GLfloat)height; GLfloat nrange = height/4.0; if(height == 0) height = 1; glviewport(0, 0, width, height); glmatrixmode(gl_projection); glloadidentity(); if (bperspective) gluperspective(60.0f, faspect, 1.0, 400.0); else if (width <= height) glortho (-nrange, nrange, -nrange/faspect, nrange/faspect, -nrange*4.0f, nrange*4.0f); else glortho (-nrange*faspect, nrange*faspect, -nrange, nrange, -nrange*4.0f, nrange*4.0f); glmatrixmode(gl_modelview); glloadidentity();

33 Example orthogonal and perspective projections (cont d) void ChangeSize(GLsizei w, GLsizei h) width = w; height = h; SetProjection(); void SpecialKeys(int key, int x, int y) if(key == GLUT_KEY_UP) if(key == GLUT_KEY_DOWN) if(key == GLUT_KEY_LEFT) if(key == GLUT_KEY_RIGHT) xrot-= 5.0f; xrot += 5.0f; yrot -= 5.0f; yrot += 5.0f; xrot = (GLfloat)((const int)xrot % 360); yrot = (GLfloat)((const int)yrot % 360); if (key == GLUT_KEY_F1) bperspective =!bperspective; SetProjection(); glutpostredisplay();

34 Example orthogonal and perspective projections (cont d) void RenderScene(void) glclear(gl_color_buffer_bit GL_DEPTH_BUFFER_BIT); glpushmatrix(); gltranslatef(0.0f, 0.0f, f); glrotatef(xrot, 1.0f, 0.0f, 0.0f); glrotatef(yrot, 0.0f, 1.0f, 0.0f); glcolor3f(1.0f, 0.0f, 0.0f); glutwirecube(100.0); glpopmatrix(); glutswapbuffers(); int main(int argc, char *argv[]) glutinit(&argc, argv); glutinitdisplaymode(glut_double GLUT_RGB GLUT_DEPTH); glutinitwindowsize(600, 600); glutcreatewindow("perspective Projection"); glutreshapefunc(changesize); glutspecialfunc(specialkeys); glutdisplayfunc(renderscene); glutmainloop(); return 0;

35 The LookAt function void glulookat(gldouble eyex, GLdouble eyey, GLdouble eyez, GLdouble centerx, GLdouble centery, GLdouble centerz, GLdouble upx, GLdouble upy, Gldouble upz) Eye : the position of the eye point. Center : the position of the reference point. Up : the direction of the up vector. glulookat creates a viewing matrix derived from an eye point, a reference point indicating the center of the scene, and an UP vector. center x, center y, center z

36 Camera object example Reference Camera object The transformation matrix is formed by up, forward, along vector and position. Not using glulookat, glrotate, gltranslation up, forward, along vectors are orthogonal. up, forward, along vectors are updated when camera is moved.

37 Camera object example (cont d) struct Vector3D float x; float y; float z; ; class Camera private: Vector3D Position; Vector3D Along; Vector3D Up; Vector3D Forward; public: theta); theta); ; void Pitch(GLfloat void Yaw(GLfloat theta); void Roll(GLfloat void Update();...

38 Practice HW1 Modify practice3_2_smooth.cpp to add the Mars Assume (without scientific basis) that The Mars are twice as far as the Earth from the Sun The Mars self-rotates twice faster than the Earth The Mars has two times longer orbital period than the Earth Color the Sun yellow, the Mars red, and the Earth blue You probably need to extend the size of the view volume Submit the entire set of sources and CMakeLists.txt to title: your student id::your name Practice HW1 Please strictly obey the title format. Otherwise, it might not be evaluated.

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

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

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

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

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

// 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

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

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

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

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

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

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

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

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 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

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

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

OpenGL Transformations

OpenGL Transformations OpenGL Transformations R. J. Renka Department of Computer Science & Engineering University of North Texas 02/18/2014 Introduction The most essential aspect of OpenGL is the vertex pipeline described in

More information

Computer Graphics CS 543 Lecture 5 (Part 2) Implementing Transformations

Computer Graphics CS 543 Lecture 5 (Part 2) Implementing Transformations Computer Graphics CS 543 Lecture 5 (Part 2) Implementing Transformations Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Objectives Learn how to implement transformations

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

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

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

Computer Graphics. OpenGL

Computer Graphics. OpenGL Computer Graphics OpenGL What is OpenGL? OpenGL (Open Graphics Library) is a library for computer graphics It consists of several procedures and functions that allow a programmer to specify the objects

More information

OpenGL Tutorial. Ceng 477 Introduction to Computer Graphics

OpenGL Tutorial. Ceng 477 Introduction to Computer Graphics OpenGL Tutorial Ceng 477 Introduction to Computer Graphics Adapted from: http://www.cs.princeton.edu/courses/archive/spr06/cos426/assn3/opengl_tutorial.ppt OpenGL IS an API OpenGL IS nothing more than

More information

Lecture 2 CISC440/640 Spring Department of Computer and Information Science

Lecture 2 CISC440/640 Spring Department of Computer and Information Science Lecture 2 CISC440/640 Spring 2015 Department of Computer and Information Science Today s Topic The secrets of Glut-tony 2 So let s do some graphics! For the next week or so this is your world: -1 1-1 1

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

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

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

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

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

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

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

CS D Transformation. Junqiao Zhao 赵君峤

CS D Transformation. Junqiao Zhao 赵君峤 CS10101001 3D Transformation Junqiao Zhao 赵君峤 Department of Computer Science and Technology College of Electronics and Information Engineering Tongji University Review Translation Linear transformation

More information

CSCI E-74. Simulation and Gaming

CSCI E-74. Simulation and Gaming CSCI E-74 Virtual and Augmented Reality for Simulation and Gaming Fall term 2017 Gianluca De Novi, PhD Lesson 3 General Introduction to OpenGL APIs and TRS Perspective Simulation Perspective simulation

More information

FAKULTI TEKNOLOGI MAKLUMAT DAN KOMUNIKASI BITM INTERACTIVE COMPUTER GRAPHICS LAB SESSION 4. C++ - OpenGL

FAKULTI TEKNOLOGI MAKLUMAT DAN KOMUNIKASI BITM INTERACTIVE COMPUTER GRAPHICS LAB SESSION 4. C++ - OpenGL FAKULTI TEKNOLOGI MAKLUMAT DAN KOMUNIKASI BITM 3213 - INTERACTIVE COMPUTER GRAPHICS LAB SESSION 4 C++ - OpenGL Part 1- C++ - Texture Mapping 1. Download texture file and put it into your current folder

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

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

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

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

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

GL_COLOR_BUFFER_BIT, GL_PROJECTION, GL_MODELVIEW

GL_COLOR_BUFFER_BIT, GL_PROJECTION, GL_MODELVIEW OpenGL Syntax Functions have prefix gl and initial capital letters for each word glclearcolor(), glenable(), glpushmatrix() glu for GLU functions glulookat(), gluperspective() constants begin with GL_,

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

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

3D computer graphics: geometric modeling of objects in the computer and rendering them

3D computer graphics: geometric modeling of objects in the computer and rendering them SE313: Computer Graphics and Visual Programming Computer Graphics Notes Gazihan Alankus, Spring 2012 Computer Graphics 3D computer graphics: geometric modeling of objects in the computer and rendering

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

Matrix-Rechnung I ' z =... Universität Frankfurt

Matrix-Rechnung I ' z =... Universität Frankfurt Matrix-Rechnung I x =Ax = = 1.................................... ' ' ' ' ' 44 41 14 11 z y x a a a a w z y x Matrix-Rechnung II Matrixmultiplikation ist assoziativ, abernicht kommutativ. OpenGL multipliziert

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

Using OpenGL with CUDA

Using OpenGL with CUDA Using OpenGL with CUDA Installing OpenGL and GLUT; compiling with nvcc Basics of OpenGL and GLUT in C Interoperability between OpenGL and CUDA OpenGL = Open Graphic Library creation of 3D graphic primitives

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

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

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

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

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

CS 4204 Computer Graphics

CS 4204 Computer Graphics CS 424 Computer Graphics 2D Transformations Yong Cao Virginia Tech References: Introduction to Computer Graphics course notes by Doug Bowman Interactive Computer Graphics, Fourth Edition, Ed Angle Transformations

More information

Transformations. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Transformations. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Transformations CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1 Objectives Introduce standard transformations - Rotation - Translation - Scaling - Shear Derive

More information

CMSC 425: Lecture 4 More about OpenGL and GLUT Tuesday, Feb 5, 2013

CMSC 425: Lecture 4 More about OpenGL and GLUT Tuesday, Feb 5, 2013 CMSC 425: Lecture 4 More about OpenGL and GLUT Tuesday, Feb 5, 2013 Reading: See any standard reference on OpenGL or GLUT. Basic Drawing: In the previous lecture, we showed how to create a window in GLUT,

More information

Teacher Assistant : Tamir Grossinger Reception hours: by - Building 37 / office -102 Assignments: 4 programing using

Teacher Assistant : Tamir Grossinger   Reception hours: by  - Building 37 / office -102 Assignments: 4 programing using Teacher Assistant : Tamir Grossinger email: tamirgr@gmail.com Reception hours: by email - Building 37 / office -102 Assignments: 4 programing using C++ 1 theoretical You can find everything you need in

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

Computer Graphics. Transformations. CSC 470 Computer Graphics 1

Computer Graphics. Transformations. CSC 470 Computer Graphics 1 Computer Graphics Transformations CSC 47 Computer Graphics 1 Today s Lecture Transformations How to: Rotate Scale and Translate 2 Introduction An important concept in computer graphics is Affine Transformations.

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 GLUT 2 Events in OpenGL Event Example Keypress KeyDown KeyUp Mouse leftbuttondown leftbuttonup With mouse

More information

Advanced Computer Graphics (CS & SE )

Advanced Computer Graphics (CS & SE ) Advanced Computer Graphics (CS & SE 233.420) Topics Covered Picking Pipeline Viewing and Transformations Rendering Modes OpenGL can render in one of three modes selected by glrendermode(mode) GL_RENDER

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

Graphics Programming. August 31, Programming of the Sierpinski gasket. Programming with OpenGL and C/C++

Graphics Programming. August 31, Programming of the Sierpinski gasket. Programming with OpenGL and C/C++ Computer Graphics Graphics Programming August 31, 2005 Contents Our Goal in This Chapter Programming of the Sierpinski gasket How To? Programming with OpenGL and C/C++ OpenGL API (Application Programmer

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

COMPUTER GRAPHICS LAB # 3

COMPUTER GRAPHICS LAB # 3 COMPUTER GRAPHICS LAB # 3 Chapter 2: COMPUTER GRAPHICS by F.S HILLs. Initial steps in drawing figures (polygon, rectangle etc) Objective: Basic understanding of simple code in OpenGL and initial steps

More information

Objectives. transformation. General Transformations. Affine Transformations. Notation. Pipeline Implementation. Introduce standard transformations

Objectives. transformation. General Transformations. Affine Transformations. Notation. Pipeline Implementation. Introduce standard transformations Objectives Transformations CS Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Introduce standard transformations - Rotation - Translation - Scaling - Shear Derive homogeneous

More information

Introduction to 3D Graphics with OpenGL. Z-Buffer Hidden Surface Removal. Binghamton University. EngiNet. Thomas J. Watson

Introduction to 3D Graphics with OpenGL. Z-Buffer Hidden Surface Removal. Binghamton University. EngiNet. Thomas J. Watson 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

GL_MODELVIEW transformation

GL_MODELVIEW transformation lecture 3 view transformations model transformations GL_MODELVIEW transformation view transformations: How do we map from world coordinates to camera/view/eye coordinates? model transformations: How do

More information

part 3 Martin Samuelčík Room I4

part 3 Martin Samuelčík  Room I4 art 3 Martin Sauelčík htt://www.sccg.sk/~sauelcik Roo I4 Vertex coordinates Fro inut coordinates to window coordinates Coordinates are always related to coordinates syste, sace, frae Transforing vertex

More information

Computer Graphics Course 2005

Computer Graphics Course 2005 Computer Graphics Course 2005 Introduction to GLUT, GLU and OpenGL Administrative Stuff Teaching Assistant: Rony Goldenthal Reception Hour: Wed. 18:00 19:00 Room 31 (Ross 1) Questions: E-mail: cg@cs Newsgroups:

More information

Computer Viewing Computer Graphics I, Fall 2008

Computer Viewing Computer Graphics I, Fall 2008 Computer Viewing 1 Objectives Introduce mathematics of projection Introduce OpenGL viewing functions Look at alternate viewing APIs 2 Computer Viewing Three aspects of viewing process All implemented in

More information

Draw the basic Geometry Objects. Hanyang University

Draw the basic Geometry Objects. Hanyang University Draw the basic Geometry Objects Hanyang University VERTEX ATTRIBUTE AND GEOMETRIC PRIMITIVES Vertex Vertex A point in 3D space, or a corner of geometric primitives such as triangles, polygons. Vertex attributes

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 OpenGL Basics Yong Cao Virginia Tech References: 2001 Siggraph, An Interactive Introduction to OpenGL Programming, Dave Shreiner,Ed Angel, Vicki Shreiner Official Presentation

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

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

Computer Graphics. Bing-Yu Chen National Taiwan University

Computer Graphics. Bing-Yu Chen National Taiwan University Computer Graphics Bing-Yu Chen National Taiwan University Introduction to OpenGL General OpenGL Introduction An Example OpenGL Program Drawing with OpenGL Transformations Animation and Depth Buffering

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

An Interactive Introduction to OpenGL Programming

An Interactive Introduction to OpenGL Programming An Interactive Introduction to OpenGL Programming Course # 29 Dave Shreiner Ed Angel Vicki Shreiner Table of Contents Introduction...iv Prerequisites...iv Topics...iv Presentation Course Notes...vi An

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

Image Rendering. Rendering can be divided into three sub-problems. Image Formation The hidden surface problem visibility determination steps

Image Rendering. Rendering can be divided into three sub-problems. Image Formation The hidden surface problem visibility determination steps Image Rendering Rendering can be divided into three sub-problems Image Formation The hidden surface problem visibility determination steps Illumination Direct illumination Indirect illumination Shading

More information

CS380: Computer Graphics Basic OpenGL Structure. Sung-Eui Yoon ( 윤성의 ) Course URL:

CS380: Computer Graphics Basic OpenGL Structure. Sung-Eui Yoon ( 윤성의 ) Course URL: CS380: Computer Graphics Basic OpenGL Structure Sung-Eui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/cg Class Objectives Understand the basic OpenGL program structure and how OpenGL supports

More information

OpenGL/GLUT Intro. Week 1, Fri Jan 12

OpenGL/GLUT Intro. Week 1, Fri Jan 12 University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner OpenGL/GLUT Intro Week 1, Fri Jan 12 http://www.ugrad.cs.ubc.ca/~cs314/vjan2007 News Labs start next week Reminder:

More information

Transformation Pipeline

Transformation Pipeline Transformation Pipeline Local (Object) Space Modeling World Space Clip Space Projection Eye Space Viewing Perspective divide NDC space Normalized l d Device Coordinatesd Viewport mapping Screen space Coordinate

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

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

Lecture 2 2D transformations Introduction to OpenGL

Lecture 2 2D transformations Introduction to OpenGL Lecture 2 2D transformations Introduction to OpenGL OpenGL where it fits what it contains how you work with it OpenGL parts: GL = Graphics Library (core lib) GLU = GL Utilities (always present) GLX, AGL,

More information

Announcements OpenGL. Computer Graphics. Spring CS4815

Announcements OpenGL. Computer Graphics. Spring CS4815 Computer Graphics Spring 2017-2018 Outline 1 2 Tutes and Labs Tute02, vector review (see matrix) Week02 lab Lab Marking 10 labs in total each lab worth 3% of overall grade marked on attendance and completion

More information

Lecture 5b. Transformation

Lecture 5b. Transformation Lecture 5b Transformation Refresher Transformation matrices [4 x 4]: the fourth coordinate is homogenous coordinate. Rotation Transformation: Axis of rotation must through origin (0,0,0). If not, translation

More information

Introduction to OpenGL

Introduction to OpenGL CS100433 Introduction to OpenGL Junqiao Zhao 赵君峤 Department of Computer Science and Technology College of Electronics and Information Engineering Tongji University Before OpenGL Let s think what is need

More information

Ulf Assarsson Department of Computer Engineering Chalmers University of Technology

Ulf Assarsson Department of Computer Engineering Chalmers University of Technology Ulf Assarsson Department of Computer Engineering Chalmers University of Technology 1. I am located in room 4115 in EDIT-huset 2. Email: 3. Phone: 031-772 1775 (office) 4. Course assistant: Tomas Akenine-Mőller

More information

Introduction to OpenGL and 3D Graphics

Introduction to OpenGL and 3D Graphics Introduction to OpenGL and 3D Graphics Categories Introduction to graphics The History of 3D Graphics How 3D Graphics work Drawing Points, Lines and Polygons in OpenGL Transformations and Perspective Introduction

More information

7. 3D Viewing. Projection: why is projection necessary? CS Dept, Univ of Kentucky

7. 3D Viewing. Projection: why is projection necessary? CS Dept, Univ of Kentucky 7. 3D Viewing Projection: why is projection necessary? 1 7. 3D Viewing Projection: why is projection necessary? Because the display surface is 2D 2 7.1 Projections Perspective projection 3 7.1 Projections

More information

Project Sketchpad. Ivan Sutherland (MIT 1963) established the basic interactive paradigm that characterizes interactive computer graphics:

Project Sketchpad. Ivan Sutherland (MIT 1963) established the basic interactive paradigm that characterizes interactive computer graphics: Project Sketchpad Ivan Sutherland (MIT 1963) established the basic interactive paradigm that characterizes interactive computer graphics: User sees an object on the display User points to (picks) the object

More information

Chapter 13 Selection and Feedback

Chapter 13 Selection and Feedback OpenGL Programming Guide (Addison-Wesley Publishing Company) Chapter 13 Selection and Feedback Chapter Objectives After reading this chapter, you ll be able to do the following: Create applications that

More information

CS418 OpenGL & GLUT Programming Tutorial (I) Presented by : Wei-Wen Feng 1/30/2008

CS418 OpenGL & GLUT Programming Tutorial (I) Presented by : Wei-Wen Feng 1/30/2008 CS418 OpenGL & GLUT Programming Tutorial (I) Presented by : Wei-Wen Feng 1/30/2008 2008/2/3 Slide 2 I Am Your TA Name : Wei-Wen Wen Feng 4th Year Graduate Student in Graphics I will be Holding discussion/tutorial

More information

CS 591B Lecture 9: The OpenGL Rendering Pipeline

CS 591B Lecture 9: The OpenGL Rendering Pipeline CS 591B Lecture 9: The OpenGL Rendering Pipeline 3D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination Spring 2007 Rui Wang 3D Polygon Rendering Many applications

More information

Viewing Transformation

Viewing Transformation CS38: Computer Graphics Viewing Transformation Sung-Eui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/cg/ Class Objectives Know camera setup parameters Understand viewing and projection processes

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