Computer graphic -- Programming with OpenGL 2

Size: px
Start display at page:

Download "Computer graphic -- Programming with OpenGL 2"

Transcription

1 Computer graphic -- Programming with OpenGL 2

2 OpenGL OpenGL (Open Graphics Library) a cross-language, multi-platform API for rendering 2D and 3D computer graphics. The API is typically used to interact with a GPU, to achieve hardware-accelerated rendering. OpenGL was developed by Silicon Graphics Inc. in 1992 and is widely used in CAD, virtual reality, scientific visualization, information visualization, flight simulation, and video games. OpenGL is managed by the non-profit technology consortium Khronos Group. 2

3 Documentation OpenGL's popularity is partially due to the quality of its official documentation. The OpenGL ARB released a series of manuals along with the specification which have been updated to track changes in the API. These are almost universally known by the colors of their covers: The Red Book OpenGL Programming Guide, 7th edition. ISBN A readable tutorial and reference book this is a 'must have' book for OpenGL programmers. The Green Book OpenGL Programming for the X Window System. ISBN A book about X11 interfacing and GLUT. The Blue Book OpenGL Reference manual, 4th edition. ISBN X Essentially a hard-copy printout of the man pages for OpenGL. Includes a poster-sized fold-out diagram showing the structure of an idealised OpenGL implementation. The Alpha Book (white cover) OpenGL Programming for Windows 95 and Windows NT. ISBN A book about interfacing OpenGL with Microsoft Windows. Then, for OpenGL 2.0 and beyond: The Orange Book OpenGL Shading Language, 3rd edition. ISBN A readable tutorial and reference book for GLSL. 3

4 History 4

5 OpenGL Webpage Wiki Function I_Reference 5

6 Basic GL Operation (x,y,z) (RGB) Pixel (x,y,z, RGB) 6

7 24-bit true color Bitplane registers bit DAC Color Guns Blue 75 pixel Green bit DAC 8 DAC: digital-to-analog converter bit DAC Red 10 CRT Raster Frame Buffer 7

8 Basic GL Operation Commands enter the GL on the left. Some commands specify geometric objects to be drawn while others control how the objects are handled by the various stages. Commands are effectively sent through a processing pipeline. Pixel (x,y,z, RGB) 8

9 Basic GL Operation Geometric Shading The first stage operates on geometric primitives described by vertices: points, line segments, and polygons. In this stage vertices may be transformed and lit, followed by assembly into geometric primitives, which may optionally be used by the next stage, i.e., geometry shading, to generate new primitives. 9

10 Basic GL Operation primitive assembly The final resulting primitives are clipped to a clip volume in preparation for the next stage, rasterization. 10

11 Basic GL Operation Rasterization The rasterizer produces a series of framebuffer addresses and values using a two dimensional description of a point, line segment, or polygon. 11

12 Basic GL Operation Fragment Each fragment is fed to the next stage that performs operations on individual fragments before they finally alter the framebuffer. These operations include conditional updates into the framebuffer based on incoming and previously stored depth values (to effect depth buffering), blending of incoming fragment colors with stored colors, as well as masking and other logical operations on fragment values. 12

13 Basic GL Operation Framebuffer Values may also be read back from the framebuffer or copied from one portion of the framebuffer to another. These transfers may include some type of decoding or encoding. This ordering is meant only as a tool for describing the GL, not as a strict rule of how the GL is implemented, and we present it only as a means to organize the various operations of the GL. 13

14 14

15 Compute shader A compute shader is a programmable shader stage that expands Microsoft Direct3D 11 beyond graphics programming. The compute shader technology is also known as the DirectCompute technology. Like other programmable shaders (vertex and geometry shaders for example), a compute shader is designed and implemented with HLSL but that is just about where the similarity ends. provide high-speed general purpose computing and takes advantage of the large numbers of parallel processors on the graphics processing unit (GPU). provide memory sharing and thread synchronization features to allow more effective parallel programming methods. 15

16 OpenGL 4.3 OpenGL 4.3 Core Profile Specification ore pdf 16

17 OpenGL Shading The OpenGL Shading Language is actually several closely related languages. These languages are used to create shaders for each of the programmable processors contained in the OpenGL processing pipeline. Vertex tessellation control tessellation evaluation geometry fragment compute processors Document 17

18 Vertex Processor The vertex processor is a programmable unit that operates on incoming vertices and their associated data. vertex shaders Compilation units written in the OpenGL Shading Language run on this processor. vertex shader executable When a set of vertex shaders are successfully compiled and linked, they result in a vertex shader executable that runs on the vertex processor. 18

19 Tessellation Control Processor The tessellation control processor is a programmable unit that operates on a patch of incoming vertices and their associated data, emitting a new output patch. tessellation control shaders Compilation units written in the OpenGL Shading Language to run on this processor are called tessellation control shaders. tessellation control shader executable When a set of tessellation control shaders are successfully compiled and linked, they result in a tessellation control shader executable that runs on the tessellation control processor. 19

20 Tessellation Evaluation Processor The tessellation evaluation processor is a programmable unit that evaluates the position and other attributes of a vertex generated by the tessellation primitive generator, using a patch of incoming vertices and their associated data. tessellation evaluation shaders Compilation units written in the OpenGL Shading Language to run on this processor are called tessellation evaluation shaders. tessellation evaluation shader executable When a set of tessellation evaluation shaders are successfully compiled and linked, they result in a tessellation evaluation shader executable that runs on the tessellation evaluation processor. 20

21 Geometry Processor The geometry processor is a programmable unit that operates on data for incoming vertices for a primitive assembled after vertex processing and outputs a sequence of vertices forming output primitives. geometry shaders Compilation units written in the OpenGL Shading Language to run on this processor are called geometry shaders. geometry shader executable When a set of geometry shaders are successfully compiled and linked, they result in a geometry shader executable that runs on the geometry processor. 21

22 Fragment Processor The fragment processor is a programmable unit that operates on fragment values and their associated data. fragment shaders Compilation units written in the OpenGL Shading Language to run on this processor are called fragment shaders. fragment shader executable When a set of fragment shaders are successfully compiled and linked, they result in a fragment shader executable that runs on the fragment processor. 22

23 Compute Processor The compute processor is a programmable unit that operates independently from the other shader processors. compute shaders Compilation units written in the OpenGL Shading Language to run on this processor are called compute shaders. compute shader executable When a set of compute shaders are successfully compiled and linked, they result in a compute shader executable that runs on the compute processor. provide high-speed general purpose computing and takes advantage of the large numbers of parallel processors on the graphics processing unit (GPU). 23

24 24

25 Demo E:\course-CG\2011\froblins.mov 25

26 Basics of GLUT 26

27 Basics of GLUT Why GLUT? a popular library for OpenGL programmers, because it standardizes and simplifies window and event management. ported atop a variety of OpenGL implementations, including both the X Window System and Microsoft Windows NT. 27

28 Initializing and Creating a Window Before open a window, you must specify its characteristics: single-buffered or double-buffered store colors as RGBA values or color indices Where should it appear on your display? Answers: glutinit(), glutinitdisplaymode(), glutinitwindowsize(), glutinitwindowposition(), glutcreatewindow(). 28

29 glutinit() void glutinit (int argc, char **argv); glutinit() should be called before any other GLUT routine, because it initializes the GLUT library. 29

30 glutinitdisplaymode() void glutinitdisplaymode(unsigned int mode); Specify a display mode RGBA or color-index (GLUT_RGBA or GLUT_INDEX) single- or double-buffered (GLUT_SINGLE or GLUT_DOUBLE) specify that the window have an associated depth, stencil, and/or accumulation buffer. GLUT_DEPTH, GLUT_STENCIL, or GLUT_ACCUM. 30

31 glutinitwindowsize() void glutinitwindowsize(int width, int height); height width 31

32 glutinitwindowposition() void glutinitwindowposition(int x, int y); Requests windows to have an initial size and position. The arguments (x, y) indicate the location of a corner of the window 32

33 glutcreatewindow() int glutcreatewindow(char *name); Opens a window with characteristics display mode, width, height The string name appear in title bar. 33

34 glutdisplayfunc() void glutdisplayfunc(void (*func)(void)) redrawn the contents of the window. initially opened pop and damage 34

35 glutreshapefunc() void glutreshapefunc (void (*func)(int width, int height)); resizedor moved the window. Func: a pointer to a function that expects two arguments, the new width and height of a window. 35

36 glutkeyboardfunc() void glutkeyboardfunc(void (*func)(unsigned int key, int x, int y); Call the function, func, when a key that generates an ASCII character is pressed. The key callback parameter is the generated ASCII value. The x and y callback parameters indicate the location of the mouse (in window-relative coordinates) when the key was pressed. 36

37 glutmousefunc() void glutmousefunc(void (*func)(int button, int state, int x, int y)); Call the function, func, when a mouse button is pressed or released. The button callback parameter is one of GLUT_LEFT_BUTTON, GLUT_MIDDLE_BUTTON, or GLUT_RIGHT_BUTTON. The state callback parameter is either GLUT_UP or GLUT_DOWN, depending upon whether the mouse has been released or pressed. The x and y callback parameters indicate the location (in windowrelative coordinates) of the mouse when the event occurred. 37

38 glutmotionfunc() void glutmotionfunc(void (*func)(int x, int y)); Call the function, func, when the mouse pointer moves within the window while one or more mouse buttons is pressed. The x and y callback parameters indicate the location (in window-relative coordinates) of the mouse when the event occurred. 38

39 glutpostredisplay() void glutpostredisplay(void); Marksthe current window as needing to be redrawn. 39

40 glutsetcolor() void glutsetcolor(glint index, GLfloat red, GLfloat green, GLfloat blue); Load the index in the color map Index: red, green, and blue. normalized to [0.0,1.0]. 40

41 glutidlefunc() void glutidlefunc(void (*func)(void)); Call the function, func, if no other events are pending. For example, when the event loop would otherwise be idle. This is particularly useful for continuous animation or other background processing. If NULL (zero) is passed in, execution of func is disabled. 41

42 glutmainloop() void glutmainloop(void); After all the setup is completed, GLUT programs enter an event processing loop, never to return. Registered callback functions will be called when the corresponding events instigate them. 42

43 Transformations and Timers 43

44 Transformations and Timers Transformations: View a geometric model in any orientation in 3D space gltranslatef(0.0f, 0.0f, -5.0f); //Move forward 5 units glrotatef (30.0f, 0.0f, 0.0f, 1.0f); //Rotate about the z-axis glpushmatrix(); //Save the transformations performed thus far glpopmatrix(); //Undo the move to the center of the trapezoid glmatrixmode(gl_modelview); //Switch to the drawing perspective gluttimerfunc(25, update, 0); //Add a timer Model Rotation Model Scaling 44

45 Color 45

46 Color glcolor3f(0.5f, 0.0f, 0.8f); Green (R G B) 1 Yellow Black Cyan Blue Megenta (0.5f, 0.0f, 0.8f) White Red Blue Color map Color cube Green Red Color palette 46

47 Lighting Lighting is 5% of light setup and 95% of revisions and adjustments. Jeremy Birn Digital Lighting and Rendering 47

48 Imaging function I=f(ρ, n, s) I: radiosity (intensity) ρ: albedo N: unit normal S: source vector Lighting magnitude proportional to intensity of the source Lambertian model I=ρ n s N ρ S 48

49 Lighting Light source Diffuse Light Ambient light Specular Light N ρ S 49

50 Lighting- source Diffuse Light: shines upon an object indirectly. affected by the distance and angle between the surface and the light, unaffected by the viewers position or view angle. Add spotlight by OpenGL GLfloat lightcolor0[] = {0.5f, 0.5f, 0.5f, 1.0f}; //Color (0.5, 0.5, 0.5) GLfloat lightpos0[] = {4.0f, 0.0f, 8.0f, 1.0f}; //Positioned at (4, 0, 8) gllightfv(gl_light0, GL_DIFFUSE, lightcolor0); gllightfv(gl_light0, GL_POSITION, lightpos0); 50

51 Lighting- source Ambient light: light that is considered to be everywhere. no source, Numerous large light sources are generally positioned in such a way Add ambient light by OpenGL GLfloat ambientcolor[] = {0.2f, 0.2f, 0.2f, 1.0f}; gllightmodelfv(gl_light_model_ambient, ambientcolor); Diffuse Light Diffuse and Ambient Lighting 51

52 Lighting- source Specular Light: refered to as Specular Highlight, it highlights an object with a reflective color. Add specular light by OpenGL GLfloat specular0[] = {1.0, 1.0, 1.0, 1.0}; gllightfv(gl_light0, GL_SPECULAR, specular0); Diffuse Light Diffuse and Ambient Lighting Diffuse, Ambient and Specular Lighting 52

53 Lighting- Attenuation Attenuation with distance generates a softer and more realistic image: d is the distance computed by OpenGL a = GL_CONSTANT_ATTENUATION (default 1.0) b = GL_LINEAR_ATTENUATION (default 0.0) c = GL_QUADRATIC_ATTENUATION (default 0.0) Default is no attenuation: a=1, b=0, c=0 53

54 Lighting-Function specify light source parameters 54

55 Lighting-Source example specify light source parameters I = I amb +I diff +I spec = I a K a + I d K d N L + I s K s (R V) n GLfloat position0[] = {1.0, 1.0, 1.0, 0.0}; GLfloat diffuse0[] = {1.0, 0.0, 0.0, 1.0}; // I d term - Red GLfloat specular0[] = {1.0, 1.0, 1.0, 1.0}; // I s term - White GLfloat ambient0[] = {0.1, 0.1, 0.1, 1.0}; // I a term - Gray glenable(gl_lighting); glenable(gl_light0); gllightfv(gl_light0, GL_POSITION, position0); gllightfv(gl_light0, GL_DIFFUSE, diffuse0); gllightfv(gl_light0, GL_SPECULAR, specular0); gllightfv(gl_light0, GL_AMBIENT, ambient0); 55

56 Lighting- Normal Normal : A face's normal is a vector that is perpendicular to the face. glnormal3f(1.0f, 0.0f, 0.0f); tell OpenGL the "normals" of the different shapes in our scene. OpenGL Programming Guide or The Red Book : Appendix E : Calculating Normal Vectors N ρ S 56

57 Lighting - Material Once lighting is enabled, colors are no longer used N ρ S 57

58 Lighting - Material Main functions for OpenGL: 58

59 Lighting-source example specify a material I = I amb +I diff +I spec = I a K a + I d K d N L + I s K s (R V) n param: GL_AMBIENT // K a term GL_DIFFUSE // K d term GL_SPECULAR // K s term GL_SHININESS // exponent n GL_AMBIENT_AND_DIFFUSE // K a = K d GL_EMISSION // No light calculations // simulates sources 59

60 Lighting - Material 60

61 Demo SIGGRAPH 2012 : Emerging Technologies More about Siggraph

62 Reference Course Resources OpenGL on Sigraph OpenGL Video Tutorial: _is_opengl/text.php Nehe OpenGl with Java 62

63 On-Line Resources start here; up to date specification and lots of sample code online man pages for all OpenGL functions Brian Paul s Mesa 3D ngl.html very special thanks to Nate Robins for the OpenGL Tutors source code for tutors available here! 63

64 Books OpenGL Programming Guide, 7 th Edition The OpenGL Shading Language, 3 rd Edition Interactive Computer Graphics: A top-down approach with OpenGL, 5 th Edition OpenGL Programming for the X Window System OpenGL: A Primer 3 rd Edition OpenGL Distilled OpenGL Programming on Mac OS X 64

65 The end of this lecture! 65

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

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

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

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

ERKELEY DAVIS IRVINE LOS ANGELES RIVERSIDE SAN DIEGO SAN FRANCISCO EECS 104. Fundamentals of Computer Graphics. OpenGL

ERKELEY DAVIS IRVINE LOS ANGELES RIVERSIDE SAN DIEGO SAN FRANCISCO EECS 104. Fundamentals of Computer Graphics. OpenGL ERKELEY DAVIS IRVINE LOS ANGELES RIVERSIDE SAN DIEGO SAN FRANCISCO SANTA BARBARA SANTA CRUZ EECS 104 Fundamentals of Computer Graphics OpenGL Slides courtesy of Dave Shreine, Ed Angel and Vicki Shreiner

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

CS 432 Interactive Computer Graphics

CS 432 Interactive Computer Graphics CS 432 Interactive Computer Graphics Lecture 1 Part 3 Anatomy of OpenGL Programs Matt Burlick - Drexel University - CS 432 1 Reading Angel Chapter 2 Red Book Chapter 4 Matt Burlick - Drexel University

More information

OpenGL refresher. Advanced Computer Graphics 2012

OpenGL refresher. Advanced Computer Graphics 2012 Advanced Computer Graphics 2012 What you will see today Outline General OpenGL introduction Setting up: GLUT and GLEW Elementary rendering Transformations in OpenGL Texture mapping Programmable shading

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

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

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

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

Today s Agenda. Basic design of a graphics system. Introduction to OpenGL

Today s Agenda. Basic design of a graphics system. Introduction to OpenGL Today s Agenda Basic design of a graphics system Introduction to OpenGL Image Compositing Compositing one image over another is most common choice can think of each image drawn on a transparent plastic

More information

Image Processing. Geometry Processing. Reading: (Not really covered in our text. See Sects 18.1, 18.2.) Overview: Display

Image Processing. Geometry Processing. Reading: (Not really covered in our text. See Sects 18.1, 18.2.) Overview: Display CMSC 427: Chapter 2 Graphics Libraries and OpenGL Reading: (Not really covered in our text. See Sects 18.1, 18.2.) Overview: Graphics Libraries OpenGL and its Structure Drawing Primitives in OpenGL GLUT

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

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

Basic Graphics Programming

Basic Graphics Programming CSCI 480 Computer Graphics Lecture 2 Basic Graphics Programming January 11, 2012 Jernej Barbic University of Southern California http://www-bcf.usc.edu/~jbarbic/cs480-s12/ Graphics Pipeline OpenGL API

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

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

VTU EDUSAT PROGRAMME. Computer Graphics & Visualization

VTU EDUSAT PROGRAMME. Computer Graphics & Visualization VTU EDUSAT PROGRAMME Computer Graphics & Visualization Interactions in Open GL using GLUT And Graphics Pipeline Sandeep Senan Interactions in Open GL using GLUT Ivan Sutherland (MIT 1963) established the

More information

Introduction to Computer Graphics with OpenGL/GLUT

Introduction to Computer Graphics with OpenGL/GLUT Introduction to Computer Graphics with OpenGL/GLUT What is OpenGL? A software interface to graphics hardware Graphics rendering API (Low Level) High-quality color images composed of geometric and image

More information

CSE 167: Lecture #8: Lighting. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

CSE 167: Lecture #8: Lighting. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011 CSE 167: Introduction to Computer Graphics Lecture #8: Lighting Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011 Announcements Homework project #4 due Friday, October 28 Introduction:

More information

CS Computer Graphics: OpenGL, Continued

CS Computer Graphics: OpenGL, Continued CS 543 - Computer Graphics: OpenGL, Continued by Robert W. Lindeman gogo@wpi.edu (with help from Emmanuel Agu ;-) Last time. OpenGL set up Basic structure OpenGL skeleton Callback functions, etc. R.W.

More information

CS Computer Graphics: OpenGL, Continued

CS Computer Graphics: OpenGL, Continued CS 543 - Computer Graphics: OpenGL, Continued by Robert W. Lindeman gogo@wpi.edu (with help from Emmanuel Agu ;-) Last time. OpenGL set up Basic structure OpenGL skeleton Callback functions, etc. R.W.

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

11/1/13. Basic Graphics Programming. Teaching Assistant. What is OpenGL. Course Producer. Where is OpenGL used. Graphics library (API)

11/1/13. Basic Graphics Programming. Teaching Assistant. What is OpenGL. Course Producer. Where is OpenGL used. Graphics library (API) CSCI 420 Computer Graphics Lecture 2 Basic Graphics Programming Teaching Assistant Yijing Li Office hours TBA Jernej Barbic University of Southern California Graphics Pipeline OpenGL API Primitives: Lines,

More information

OpenGL and GLUT based library for Image Processing (GLIP)

OpenGL and GLUT based library for Image Processing (GLIP) i OpenGL and GLUT based library for Image Processing (GLIP) Pre-Version 0.6 (Perversion) Antonio Marín-Hernández Universidad Veracruzana, México & LAAS CNRS, France February 2004 ii OpenGL is a trademark

More information

RECITATION - 1. Ceng477 Fall

RECITATION - 1. Ceng477 Fall RECITATION - 1 Ceng477 Fall 2007-2008 2/ 53 Agenda General rules for the course General info on the libraries GLUT OpenGL GLUI Details about GLUT Functions Probably we will not cover this part 3/ 53 General

More information

Rendering. Part 1 An introduction to OpenGL

Rendering. Part 1 An introduction to OpenGL Rendering Part 1 An introduction to OpenGL Olivier Gourmel VORTEX Team IRIT University of Toulouse gourmel@irit.fr Image synthesis The Graphics Processing Unit (GPU): A highly parallel architecture specialized

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

OpenGL. Toolkits.

OpenGL. Toolkits. http://www.opengl.org OpenGL Open Graphics Library Graphics API Delivered with UNIX, Win9x/2000/Me/Nt/Xp, Mac OS Direct3D (DirectX) is only Windows Utilizes the window system and event handling of the

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

Lighting. CSC 7443: Scientific Information Visualization

Lighting. CSC 7443: Scientific Information Visualization Lighting Why Lighting? What light source is used and how the object response to the light makes difference Ocean looks bright bluish green in sunny day but dim gray green in cloudy day Lighting gives you

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

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

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

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

VR-programming tools (procedural) More VRML later in this course! (declarative)

VR-programming tools (procedural) More VRML later in this course! (declarative) Realtime 3D Computer Graphics & Virtual Reality OpenGL Introduction VR-programming Input and display devices are the main hardware interface to users Immersion embeds users through the generation of live-like

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 2 Common Uses for Computer Graphics Applications for real-time 3D graphics range from interactive games

More information

Light Sources. Spotlight model

Light Sources. Spotlight model lecture 12 Light Sources sunlight (parallel) Sunny day model : "point source at infinity" - lighting - materials: diffuse, specular, ambient spotlight - shading: Flat vs. Gouraud vs Phong light bulb ambient

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

Projections and Hardware Rendering. Brian Curless CSE 557 Fall 2014

Projections and Hardware Rendering. Brian Curless CSE 557 Fall 2014 Projections and Hardware Rendering Brian Curless CSE 557 Fall 2014 1 Reading Required: Shirley, Ch. 7, Sec. 8.2, Ch. 18 Further reading: Foley, et al, Chapter 5.6 and Chapter 6 David F. Rogers and J. Alan

More information

Graphics Pipeline & APIs

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

More information

Lecture 11: Callbacks. CITS 3003 Graphics & Animation

Lecture 11: Callbacks. CITS 3003 Graphics & Animation Lecture 11: Callbacks CITS 3003 Graphics & Animation Slides: E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Learn to build interactive programs using GLUT callbacks

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

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008. CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions The Midterm Exam was given in class on Thursday, October 23, 2008. 1. [4 pts] Drawing Where? Your instructor says that objects should always be

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

1.2 Basic Graphics Programming

1.2 Basic Graphics Programming Fall 2018 CSCI 420: Computer Graphics 1.2 Basic Graphics Programming Hao Li http://cs420.hao-li.com 1 Last time Last Time Story Computer Graphics Image Last Time 3D Printing 3D Capture Animation Modeling

More information

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

Three-Dimensional Graphics V. Guoying Zhao 1 / 55 Computer Graphics Three-Dimensional Graphics V Guoying Zhao 1 / 55 Shading Guoying Zhao 2 / 55 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material

More information

Computer Graphics 1 Computer Graphics 1

Computer Graphics 1 Computer Graphics 1 Projects: an example Developed by Nate Robbins Shapes Tutorial What is OpenGL? Graphics rendering API high-quality color images composed of geometric and image primitives window system independent operating

More information

CS Computer Graphics: Intro to OpenGL

CS Computer Graphics: Intro to OpenGL CS 543 - Computer Graphics: Intro to OpenGL by Robert W. Lindeman gogo@wpi.edu (with help from Emmanuel Agu ;-) OpenGL Basics Last time: What is Computer Graphics? What is a graphics library What to expect

More information

CS Computer Graphics: Intro to OpenGL

CS Computer Graphics: Intro to OpenGL CS 543 - Computer Graphics: Intro to OpenGL by Robert W. Lindeman gogo@wpi.edu (with help from Emmanuel Agu ;-) OpenGL Basics Last time: What is Computer Graphics? What is a graphics library What to expect

More information

Overview. Shading. Shading. Why we need shading. Shading Light-material interactions Phong model Shading polygons Shading in OpenGL

Overview. Shading. Shading. Why we need shading. Shading Light-material interactions Phong model Shading polygons Shading in OpenGL Overview Shading Shading Light-material interactions Phong model Shading polygons Shading in OpenGL Why we need shading Suppose we build a model of a sphere using many polygons and color it with glcolor.

More information

Exercise 1 Introduction to OpenGL

Exercise 1 Introduction to OpenGL Exercise 1 Introduction to OpenGL What we are going to do OpenGL Glut Small Example using OpenGl and Glut Alexandra Junghans 2 What is OpenGL? OpenGL Two Parts most widely used and supported graphics API

More information

An Overview GLUT GLSL GLEW

An Overview GLUT GLSL GLEW OpenGL, GLUT, GLEW, GLSL An Overview GLUT GLEW GLSL Objectives Give you an overview of the software that you will be using this semester OpenGL, GLUT, GLEW, GLSL What are they? How do you use them? What

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

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

Reading. Shading. An abundance of photons. Introduction. Required: Angel , 6.5, Optional: Angel 6.4 OpenGL red book, chapter 5.

Reading. Shading. An abundance of photons. Introduction. Required: Angel , 6.5, Optional: Angel 6.4 OpenGL red book, chapter 5. Reading Required: Angel 6.1-6.3, 6.5, 6.7-6.8 Optional: Shading Angel 6.4 OpenGL red book, chapter 5. 1 2 Introduction An abundance of photons So far, we ve talked exclusively about geometry. Properly

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

CS 380 Introduction to Computer Graphics. LAB (1) : OpenGL Tutorial Reference : Foundations of 3D Computer Graphics, Steven J.

CS 380 Introduction to Computer Graphics. LAB (1) : OpenGL Tutorial Reference : Foundations of 3D Computer Graphics, Steven J. CS 380 Introduction to Computer Graphics LAB (1) : OpenGL Tutorial 2018. 03. 05 Reference : Foundations of 3D Computer Graphics, Steven J. Gortler Goals Understand OpenGL pipeline Practice basic OpenGL

More information

Comp 410/510 Computer Graphics Spring Programming with OpenGL Part 2: First Program

Comp 410/510 Computer Graphics Spring Programming with OpenGL Part 2: First Program Comp 410/510 Computer Graphics Spring 2017 Programming with OpenGL Part 2: First Program Objectives Refine the first program Introduce a standard program structure - Initialization Program Structure Most

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

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

CS Surface Rendering

CS Surface Rendering CS10101001 Surface Rendering Junqiao Zhao 赵君峤 Department of Computer Science and Technology College of Electronics and Information Engineering Tongji University Surface rendering How do we choose a color

More information

Blue colour text questions Black colour text sample answers Red colour text further explanation or references for the sample answers

Blue colour text questions Black colour text sample answers Red colour text further explanation or references for the sample answers Blue colour text questions Black colour text sample answers Red colour text further explanation or references for the sample answers Question 1. a) (5 marks) Explain the OpenGL synthetic camera model,

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

Rendering Objects. Need to transform all geometry then

Rendering Objects. Need to transform all geometry then Intro to OpenGL Rendering Objects Object has internal geometry (Model) Object relative to other objects (World) Object relative to camera (View) Object relative to screen (Projection) Need to transform

More information

Lecture 2. Determinants. Ax = 0. a 11 x 1 + a 12 x a 1n x n = 0 a 21 x 1 + a 22 x a 2n x n = 0

Lecture 2. Determinants. Ax = 0. a 11 x 1 + a 12 x a 1n x n = 0 a 21 x 1 + a 22 x a 2n x n = 0 A = a 11 a 12... a 1n a 21 a 22... a 2n. a n1 a n2... a nn x = x 1 x 2. x n Lecture 2 Math Review 2 Introduction to OpenGL Ax = 0 a 11 x 1 + a 12 x 2 +... + a 1n x n = 0 a 21 x 1 + a 22 x 2 +... + a 2n

More information

Information Coding / Computer Graphics, ISY, LiTH. OpenGL! ! where it fits!! what it contains!! how you work with it 11(40)

Information Coding / Computer Graphics, ISY, LiTH. OpenGL! ! where it fits!! what it contains!! how you work with it 11(40) 11(40) Information Coding / Computer Graphics, ISY, LiTH OpenGL where it fits what it contains how you work with it 11(40) OpenGL The cross-platform graphics library Open = Open specification Runs everywhere

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

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

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

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

CSE 167: Lecture #8: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

CSE 167: Lecture #8: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012 CSE 167: Introduction to Computer Graphics Lecture #8: GLSL Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012 Announcements Homework project #4 due Friday, November 2 nd Introduction:

More information

Why we need shading?

Why we need shading? Why we need shading? Suppose we build a model of a sphere using many polygons and color it with glcolor. We get something like But we want Light-material interactions cause each point to have a different

More information

LECTURE 02 OPENGL API

LECTURE 02 OPENGL API COMPUTER GRAPHICS LECTURE 02 OPENGL API Still from Pixar s Inside Out, 2015 IMRAN IHSAN ASSISTANT PROFESSOR WWW.IMRANIHSAN.COM EARLY HISTORY OF APIS IFIPS (1973) formed two committees to come up with a

More information

OpenGL: Open Graphics Library. Introduction to OpenGL Part II. How do I render a geometric primitive? What is OpenGL

OpenGL: Open Graphics Library. Introduction to OpenGL Part II. How do I render a geometric primitive? What is OpenGL OpenGL: Open Graphics Library Introduction to OpenGL Part II CS 351-50 Graphics API ( Application Programming Interface) Software library Layer between programmer and graphics hardware (and other software

More information

CMSC 427 Computer Graphics 1

CMSC 427 Computer Graphics 1 CMSC 427 Computer Graphics 1 David M. Mount Department of Computer Science University of Maryland Fall 2013 1 Copyright, David M. Mount, 2013 Dept. of Computer Science, University of Maryland, College

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

CEng 477 Introduction to Computer Graphics Fall

CEng 477 Introduction to Computer Graphics Fall Illumination Models and Surface-Rendering Methods CEng 477 Introduction to Computer Graphics Fall 2007 2008 Illumination Models and Surface Rendering Methods In order to achieve realism in computer generated

More information

Reading. Shading. Introduction. An abundance of photons. Required: Angel , Optional: OpenGL red book, chapter 5.

Reading. Shading. Introduction. An abundance of photons. Required: Angel , Optional: OpenGL red book, chapter 5. Reading Required: Angel 6.1-6.5, 6.7-6.8 Optional: Shading OpenGL red book, chapter 5. 1 2 Introduction So far, we ve talked exclusively about geometry. What is the shape of an obect? How do I place it

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

Rasterization Overview

Rasterization Overview Rendering Overview The process of generating an image given a virtual camera objects light sources Various techniques rasterization (topic of this course) raytracing (topic of the course Advanced Computer

More information

Lecture 3 Advanced Computer Graphics (CS & SE )

Lecture 3 Advanced Computer Graphics (CS & SE ) Lecture 3 Advanced Computer Graphics (CS & SE 233.420) Programming with OpenGL Program Structure Primitives Attributes and States Programming in three dimensions Inputs and Interaction Working with Callbacks

More information

Ambient reflection. Jacobs University Visualization and Computer Graphics Lab : Graphics and Visualization 407

Ambient reflection. Jacobs University Visualization and Computer Graphics Lab : Graphics and Visualization 407 Ambient reflection Phong reflection is a local illumination model. It only considers the reflection of light that directly comes from the light source. It does not compute secondary reflection of light

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

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

OpenGL Programming Guide Chapter 1, Introduction to OpenGL 1

OpenGL Programming Guide Chapter 1, Introduction to OpenGL 1 OpenGL Programming Guide Chapter 1, Introduction to OpenGL 1 Chapter 1 Introduction to OpenGL Chapter Objectives After reading this chapter, you ll be able to do the following: Appreciate in general terms

More information

Shading. Brian Curless CSE 457 Spring 2015

Shading. Brian Curless CSE 457 Spring 2015 Shading Brian Curless CSE 457 Spring 2015 1 Reading Required: Angel chapter 5. Optional: OpenGL red book, chapter 5. 2 Basic 3D graphics With affine matrices, we can now transform virtual 3D objects in

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

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

CHAPTER 1 Graphics Systems and Models 3

CHAPTER 1 Graphics Systems and Models 3 ?????? 1 CHAPTER 1 Graphics Systems and Models 3 1.1 Applications of Computer Graphics 4 1.1.1 Display of Information............. 4 1.1.2 Design.................... 5 1.1.3 Simulation and Animation...........

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

2 Transformations and Homogeneous Coordinates

2 Transformations and Homogeneous Coordinates Brief solutions to Exam in Computer Graphics Time and place: 08:00 3:00 Tuesday March 7, 2009, Gimogatan 4, sal Grades TD388: 3: 20pts; 4: 26pts; 5: 34pts. Glossary API Application Programmer s Interface.

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

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

Shaders. Slide credit to Prof. Zwicker

Shaders. Slide credit to Prof. Zwicker Shaders Slide credit to Prof. Zwicker 2 Today Shader programming 3 Complete model Blinn model with several light sources i diffuse specular ambient How is this implemented on the graphics processor (GPU)?

More information