IntMu.Lab5. Download all the files available from

Size: px
Start display at page:

Download "IntMu.Lab5. Download all the files available from"

Transcription

1 IntMu.Lab5 0. Download all the files available from wget make getall Analyze the program windmill.c. Compile it and run the resulting application (windmill). make./windmill An empty window is shown Base The Display() function is automaticly called whenever the window requires a redraw. Inside this function, add an horizontal square (in the xy plan) with sides of 6 units. glcolor3f(0., 0.7, 0.); glbegin(gl_quads); glvertex3f(-3., -3., 0.); glvertex3f(-3., 3., 0.); glvertex3f( 3., 3., 0.); glvertex3f( 3., -3., 0.); 1. Windmill The windmill() function is allways called from the Display() function. Here, a graphical representation of a traditional windmill will be produced Cone Inside the windmill() function, apply the tool glutsolidcone to create a cone based on the xy plan, with red color, a base radius of 1 unit and height of 1 unit. glcolor3f(0.9, 0., 0.); glutsolidcone(1., 1., 32, 1); Change the cone s position by applying a vertical translation of 3 units. gltranslatef(0., 0., 3.); Also apply a scale to increase its base radius in 20%. glscalef(1.2, 1.2, 1.);

2 1.2. Cylinder Add a vertical cylinder to reproduce the windmill body. glcolor3f(0.9, 0.9, 0.); glpushmatrix(); glscalef(1., 1., 3.); glutsolidcylinder(1., 1., 32, 1); glpopmatrix(); 1.3. Arm Add a triangular polygon to reproduce one of the windmill arms. glcolor3f(1.,1.,1.); glpushmatrix(); gltranslatef(0., -1.25, 2.4); glnormal3f(0., -1., 0.); glbegin(gl_triangles); glvertex3f( 0., 0., 0.); glvertex3f( -1.8, -0.1, 1.3); glvertex3f( -1.8, 0., 0.); glpopmatrix(); 1.4. Arms Reuse the last arm specification to create the other arms, applying successive rotations for( i=0 ; i<4 ; i++ ) glbegin(gl_triangles); glvertex3f( 0., 0., 0.); glvertex3f( 1.8, 0., 1.5); glvertex3f( 1.8, 0., 0.); glrotatef(90., 0., 1., 0.); 2. Animation Apply a rotation transformation around the y axis with constant rotation speed to the arms group. glrotatef(0.05*timenow, 0., 1., 0.); Verify that the arms position is changed each time the window is updated.

3 In order to force a constant window update, define a new callback function: void Redisplay(void) glutpostredisplay(); Register this new function as the callback tio be used in the idle state. glutidlefunc(redisplay); 3. Illumination All objects should be reproduced using the flat shaded color specified width the glcolor3f() function. In order to achieve a more realistic viewing, the illumination calculus can be implemented through the graphics pipeline. Enable the illumination calculus. glenable (GL_LIGHTING); Verify that all the objects lost their colors. 3.1 Light source Create a point light source (GL_LIGHT0) in the Init() function: float light_ambient[] = 0.2, 0.2, 0.2, 1.0 ; float light_diffuse[] = 0.35, 0.35, 0.35, 1.0 ; float light_specular[] = 1.0, 1.0, 1.0, 1.0 ; float light_position[] = 30.0, -10.0, 30.0, 1.0 ; gllightfv (GL_LIGHT0, GL_AMBIENT, light_ambient); gllightfv (GL_LIGHT0, GL_DIFFUSE, light_diffuse); gllightfv (GL_LIGHT0, GL_SPECULAR, light_specular); gllightfv (GL_LIGHT0, GL_POSITION, light_position); Turn the light source on. glenable (GL_LIGHT0); Verify that the illumination calculus is now working. 3.2 Materiais Prepare a function to define the optical properties of the used materials. void SetMaterial(float r, float g, float b) float mat_dif[] = r, g, b, 1.0 ;

4 float mat_amb[] = r, g, b, 1.0 ; float mat_spe[] = 0.2, 0.2, 0.2, 1.0 ; float mat_shi = 10.; glmaterialfv(gl_front, GL_AMBIENT, mat_amb); glmaterialfv(gl_front, GL_DIFFUSE, mat_dif); glmaterialfv(gl_front, GL_SPECULAR, mat_spe); glmaterialf( GL_FRONT, GL_SHININESS, mat_shi); Apply this function to define the properties of all used materials, replacing al the references to the function glcolor3f(): 4. Textures SetMaterial(0.9, 0., 0.); Use the SOIL (Simple OpenGL Image Loader) library to load an image that will be mapped over the base polygon. #include <SOIL/SOIL.h> unsigned char* image = SOIL_load_image("grass.jpg", &width, &height, 0, SOIL_LOAD_RGB); glbindtexture(gl_texture_2d, 0); gltexparameteri(gl_texture_2d, GL_TEXTURE_MAG_FILTER, GL_NEAREST); gltexparameteri(gl_texture_2d, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glteximage2d(gl_texture_2d, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image); SOIL_free_image_data(image); Inside the Display() function, enable the use of this texture to colorize the base polygon. glenable(gl_texture_2d); gltexenvf(gl_texture_env, GL_TEXTURE_ENV_MODE, GL_DECAL); glbindtexture(gl_texture_2d, 0); For each vertex, specify the texture coordinates, pointing to a corner of the image. glbegin(gl_quads); gltexcoord2f(0.0, 0.0); glvertex3f(-6., -6., 0.); gltexcoord2f(0.0, 1.0); glvertex3f(-6., 6., 0.); gltexcoord2f(1.0, 1.0); glvertex3f( 6., 6., 0.); gltexcoord2f(1.0, 0.0); glvertex3f( 6., -6., 0.); After the redraw of the base polygon, turn off the texture mapping, so that the other objects are not affected. gldisable(gl_texture_2d);

5 5. Submission To submit your work, copy the files windmill.c and windmill to the directory intmu/lab5/ under your WWW area in the ave server. make submit Verify that both files became available from the URL: 6. Bibliographic info The OpenGL Programming Guide: The Official Guide to Learning OpenGL, Versions 3.0 and 3.1 (7th Edition), Dave Shreiner, ISBN OpenGLBook.com, 7. Requirements SOIL (Sample OpenGL Image Loader) Source: SOIL installing: yum install SOIL SOIL-devel or: make instsoil 8. History V1, 2000, jml V2, 2004, jml V3, 2013, jml V3.1, 2014, jml V4.1, 2016, jml V4.1e, 2017, jml

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

Lecture 22 Sections 8.8, 8.9, Wed, Oct 28, 2009

Lecture 22 Sections 8.8, 8.9, Wed, Oct 28, 2009 s The s Lecture 22 Sections 8.8, 8.9, 8.10 Hampden-Sydney College Wed, Oct 28, 2009 Outline s The 1 2 3 4 5 The 6 7 8 Outline s The 1 2 3 4 5 The 6 7 8 Creating Images s The To create a texture image internally,

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

CS Computer Graphics: Illumination and Shading I

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

More information

CS Computer Graphics: Illumination and Shading I

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

More information

CSC 240 Computer Graphics. Fall 2015 Smith College

CSC 240 Computer Graphics. Fall 2015 Smith College CSC 240 Computer Graphics Fall 2015 Smith College Outline: 11/9 Stacks revisited Shading (using normal vectors) Texture Mapping Final quiz If time: robot with two arms White background slides from Eitan

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

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

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

1 /* 4 C:\opencv\build\include. 6 C:\opencv\build\x86\vc10\lib

1 /* 4 C:\opencv\build\include. 6 C:\opencv\build\x86\vc10\lib 1 1. Program 1 OpenCV (OpenCV Sample001) 1 /* 2 - > - > - >VC++ 3 ( ) 4 C:\opencv\build\include 5 ( ) 6 C:\opencv\build\x86\vc10\lib 7 - > - > - > - > 8 (240 O p e n C V ) 9 opencv_core240d.lib 10 opencv_imgproc240d.lib

More information

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

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

More information

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

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

More information

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

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

More information

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

Graphics. Texture Mapping 고려대학교컴퓨터그래픽스연구실.

Graphics. Texture Mapping 고려대학교컴퓨터그래픽스연구실. Graphics Texture Mapping 고려대학교컴퓨터그래픽스연구실 3D Rendering Pipeline 3D Primitives 3D Modeling Coordinates Model Transformation 3D World Coordinates Lighting 3D World Coordinates Viewing Transformation 3D Viewing

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

5.2 Shading in OpenGL

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

More information

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

Texture Mapping. Mike Bailey.

Texture Mapping. Mike Bailey. Texture Mapping 1 Mike Bailey mjb@cs.oregonstate.edu This work is licensed under a Creative Commons Attribution-NonCommercial- NoDerivatives 4.0 International License TextureMapping.pptx The Basic Idea

More information

三維繪圖程式設計 3D Graphics Programming Design 第七章基礎材質張貼技術嘉大資工系盧天麒

三維繪圖程式設計 3D Graphics Programming Design 第七章基礎材質張貼技術嘉大資工系盧天麒 三維繪圖程式設計 3D Graphics Programming Design 第七章基礎材質張貼技術嘉大資工系盧天麒 1 In this chapter, you will learn The basics of texture mapping Texture coordinates Texture objects and texture binding Texture specification

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

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

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

More information

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

CS 148, Summer 2012 Introduction to Computer Graphics and Imaging

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

More information

CT5510: Computer Graphics. Texture Mapping

CT5510: Computer Graphics. Texture Mapping CT5510: Computer Graphics Texture Mapping BOCHANG MOON Texture Mapping Simulate spatially varying surface properties Phong illumination model is coupled with a material (e.g., color) Add small polygons

More information

Textures. Texture Mapping. Bitmap Textures. Basic Texture Techniques

Textures. Texture Mapping. Bitmap Textures. Basic Texture Techniques Texture Mapping Textures The realism of an image is greatly enhanced by adding surface textures to the various faces of a mesh object. In part a) images have been pasted onto each face of a box. Part b)

More information

QUESTION 1 [10] 2 COS340-A October/November 2009

QUESTION 1 [10] 2 COS340-A October/November 2009 2 COS340-A QUESTION 1 [10] a) OpenGL uses z-buffering for hidden surface removal. Explain how the z-buffer algorithm works and give one advantage of using this method. (5) Answer: OpenGL uses a hidden-surface

More information

Assignment #6 2D Vector Field Visualization Arrow Plot and LIC

Assignment #6 2D Vector Field Visualization Arrow Plot and LIC Assignment #6 2D Vector Field Visualization Arrow Plot and LIC Due Oct.15th before midnight Goal: In this assignment, you will be asked to implement two visualization techniques for 2D steady (time independent)

More information

GRAFIKA KOMPUTER. ~ M. Ali Fauzi

GRAFIKA KOMPUTER. ~ M. Ali Fauzi GRAFIKA KOMPUTER ~ M. Ali Fauzi Texture Mapping WHY TEXTURE? Imagine a Chess Floor Or a Brick Wall How to Draw? If you want to draw a chess floor, each tile must be drawn as a separate quad. A large flat

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

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

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

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

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

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

+ = Texturing: Glue n-dimensional images onto geometrical objects. Texturing. Texture magnification. Texture coordinates. Bilinear interpolation

+ = Texturing: Glue n-dimensional images onto geometrical objects. Texturing. Texture magnification. Texture coordinates. Bilinear interpolation Texturing Slides done bytomas Akenine-Möller and Ulf Assarsson Chalmers University of Technology Texturing: Glue n-dimensional images onto geometrical objects Purpose: more realism, and this is a cheap

More information

CS 4731: Computer Graphics Lecture 16: Phong Illumination and Shading. Emmanuel Agu

CS 4731: Computer Graphics Lecture 16: Phong Illumination and Shading. Emmanuel Agu CS 4731: Computer Graphics Lecture 16: Phong Illumination and Shading Emmanuel Agu Recall: Setting Light Property Define colors and position a light GLfloat light_ambient[] = {0.0, 0.0, 0.0, 1.0}; GLfloat

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

Illumination & Shading I

Illumination & Shading I CS 543: Computer Graphics Illumination & Shading I Robert W. Lindeman Associate Professor Interactive Media & Game Development Department of Computer Science Worcester Polytechnic Institute gogo@wpi.edu

More information

OpenGL & Visualization

OpenGL & Visualization OpenGL & Visualization Martin Ilčík Institute of Computer Graphics and Algorithms Vienna University of Technology Motivation What is OpenGL How to use OpenGL Slices with OpenGL GPU raycasting Martin Ilčík

More information

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

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

More information

Shading/Texturing. Dr. Scott Schaefer

Shading/Texturing. Dr. Scott Schaefer Shading/Texturing Dr. Scott Schaefer Problem / Problem / Problem 4/ Problem / Problem / Shading Algorithms Flat Shading Gouraud Shading Phong Shading / Flat Shading Apply same color across entire polygon

More information

Department of Computer Sciences Graphics Spring 2013 (Lecture 19) Bump Maps

Department of Computer Sciences Graphics Spring 2013 (Lecture 19) Bump Maps Bump Maps The technique of bump mapping varies the apparent shape of the surface by perturbing the normal vectors as the surface is rendered; the colors that are generated by shading then show a variation

More information

Letterkenny Institute of Technology

Letterkenny Institute of Technology Letterkenny Institute of Technology BSc in Computing in Games Development Subject: Computer Graphics for Games Programming 2 Level: 7 Date: January 2008 Examiners: Dr. J.G. Campbell Dr. M.D.J. McNeill

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

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

Lecture 07: Buffers and Textures

Lecture 07: Buffers and Textures Lecture 07: Buffers and Textures CSE 40166 Computer Graphics Peter Bui University of Notre Dame, IN, USA October 26, 2010 OpenGL Pipeline Today s Focus Pixel Buffers: read and write image data to and from

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

Grafica Computazionale

Grafica Computazionale Grafica Computazionale lezione36 Informatica e Automazione, "Roma Tre" June 3, 2010 Grafica Computazionale: Lezione 33 Textures Introduction Steps in Texture Mapping A Sample Program Texturing algorithms

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

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

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

An Introduction to 3D Computer Graphics, Stereoscopic Image, and Animation in OpenGL and C/C++ Fore June

An Introduction to 3D Computer Graphics, Stereoscopic Image, and Animation in OpenGL and C/C++ Fore June An Introduction to 3D Computer Graphics, Stereoscopic Image, and Animation in OpenGL and C/C++ Fore June Appendix A FFmpeg Libraries A.1 Introduction FFmpeg has been a popular open-source video library

More information

Chapter 9 Texture Mapping An Overview and an Example Steps in Texture Mapping A Sample Program Specifying the Texture Texture Proxy Replacing All or

Chapter 9 Texture Mapping An Overview and an Example Steps in Texture Mapping A Sample Program Specifying the Texture Texture Proxy Replacing All or Chapter 9 Texture Mapping An Overview and an Example Steps in Texture Mapping A Sample Program Specifying the Texture Texture Proxy Replacing All or Part of a Texture Image One Dimensional Textures Using

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

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

3D Graphics and OpenGl. First Steps

3D Graphics and OpenGl. First Steps 3D Graphics and OpenGl First Steps Rendering of 3D Graphics Objects defined in (virtual/mathematical) 3D space. Rendering of 3D Graphics Objects defined in (virtual/mathematical) 3D space. We see surfaces

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

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

Discussion 3. PPM loading Texture rendering in OpenGL

Discussion 3. PPM loading Texture rendering in OpenGL Discussion 3 PPM loading Texture rendering in OpenGL PPM Loading - Portable PixMap format 1. 2. Code for loadppm(): http://ivl.calit2.net/wiki/images/0/09/loadppm.txt ppm file format: Header: 1. P6: byte

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

Assignment #5: Scalar Field Visualization 3D: Direct Volume Rendering

Assignment #5: Scalar Field Visualization 3D: Direct Volume Rendering Assignment #5: Scalar Field Visualization 3D: Direct Volume Rendering Goals: Due October 4 th, before midnight This is the continuation of Assignment 4. The goal is to implement a simple DVR -- 2D texture-based

More information

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

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

More information

CSE 167: Introduction to Computer Graphics Lecture #7: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018

CSE 167: Introduction to Computer Graphics Lecture #7: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018 CSE 167: Introduction to Computer Graphics Lecture #7: Textures Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018 Announcements Project 2 due this Friday at 2pm Grading in

More information

Why Do We Care About Lighting? Computer Graphics Lighting. The Surface Normal. Flat Shading (Per-face) Setting a Surface Normal in OpenGL

Why Do We Care About Lighting? Computer Graphics Lighting. The Surface Normal. Flat Shading (Per-face) Setting a Surface Normal in OpenGL Lightig Why Do We Care About Lightig? Lightig dis-ambiguates 3D scees This work is licesed uder a Creative Commos Attributio-NoCommercial- NoDerivatives 4.0 Iteratioal Licese Mike Bailey mjb@cs.oregostate.edu

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

ก ก ก.

ก ก ก. 418382 ก ก ก ก 5 pramook@gmail.com TEXTURE MAPPING Textures Texture Object An OpenGL data type that keeps textures resident in memory and provides identifiers

More information

OpenGL Texture Mapping. Objectives Introduce the OpenGL texture functions and options

OpenGL Texture Mapping. Objectives Introduce the OpenGL texture functions and options OpenGL Texture Mapping Objectives Introduce the OpenGL texture functions and options 1 Basic Strategy Three steps to applying a texture 1. 2. 3. specify the texture read or generate image assign to texture

More information

Assignment #3: Scalar Field Visualization 3D: Cutting Plane, Wireframe Iso-surfacing, and Direct Volume Rendering

Assignment #3: Scalar Field Visualization 3D: Cutting Plane, Wireframe Iso-surfacing, and Direct Volume Rendering Assignment #3: Scalar Field Visualization 3D: Cutting Plane, Wireframe Iso-surfacing, and Direct Volume Rendering Goals: Due October 9 th, before midnight With the results from your assignement#2, the

More information

CMSC 425: Lecture 12 Texture Mapping Thursday, Mar 14, 2013

CMSC 425: Lecture 12 Texture Mapping Thursday, Mar 14, 2013 CMSC 425: Lecture 12 Texture Mapping Thursday, Mar 14, 2013 Surface Detail: We have discussed the use of lighting as a method of producing more realistic images. This is fine for smooth surfaces of uniform

More information

Using GLU/GLUT Objects

Using GLU/GLUT Objects Using GLU/GLUT Objects GLU/GLUT provides very simple object primitives glutwirecone glutwirecube glucylinder glutwireteapot GLU/GLUT Objects Each glu/glut object has its default size, position, and orientation

More information

COMPSCI 373 S1 C - Assignment 2 Sample Solution

COMPSCI 373 S1 C - Assignment 2 Sample Solution COMPSCI 373 S1 C Assignment 2 Sample Solution 1 of 17 Computer Science COMPSCI 373 S1 C - Assignment 2 Sample Solution This assignment is worth 8.3333% of your final grade. 1. 3D Modelling and Texture

More information

Information Coding / Computer Graphics, ISY, LiTH GLSL. OpenGL Shading Language. Language with syntax similar to C

Information Coding / Computer Graphics, ISY, LiTH GLSL. OpenGL Shading Language. Language with syntax similar to C GLSL OpenGL Shading Language Language with syntax similar to C Syntax somewhere between C och C++ No classes. Straight ans simple code. Remarkably understandable and obvious! Avoids most of the bad things

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

Two possible ways to specify transformations. Each part of the object is transformed independently relative to the origin

Two possible ways to specify transformations. Each part of the object is transformed independently relative to the origin Transformations Two possible ways to specify transformations Each part of the object is transformed independently relative to the origin - Not convenient! z y Translate the base by (5,0,0); Translate the

More information

Lecture 19: OpenGL Texture Mapping. CITS3003 Graphics & Animation

Lecture 19: OpenGL Texture Mapping. CITS3003 Graphics & Animation Lecture 19: OpenGL Texture Mapping CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Introduce the OpenGL texture functions and options

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

Computer Graphics Programming

Computer Graphics Programming Computer Graphics Programming Graphics APIs Using MFC (Microsoft Foundation Class) in Visual C++ Programming in Visual C++ GLUT in Windows and Unix platform Overview and Application Graphics APIs Provide

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

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 7 Multi Texturing Data Structures in a 3D Engine Vertices/Vectors Segments Matrices Polygons

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

THE AUSTRALIAN NATIONAL UNIVERSITY Final Examinations(Semester 2) COMP4610/COMP6461 (Computer Graphics) Final Exam

THE AUSTRALIAN NATIONAL UNIVERSITY Final Examinations(Semester 2) COMP4610/COMP6461 (Computer Graphics) Final Exam THE AUSTRALIAN NATIONAL UNIVERSITY Final Examinations(Semester 2) 2009 COMP4610/COMP6461 (Computer Graphics) Final Exam Writing Period: 3 hours duration Study Period: 15 minutes duration - you may read

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

Texture Mapping. Texture Mapping. Map textures to surfaces. Trompe L Oeil ( Deceive the Eye ) The texture. Texture map

Texture Mapping. Texture Mapping. Map textures to surfaces. Trompe L Oeil ( Deceive the Eye ) The texture. Texture map CSCI 42 Computer Graphic Lecture 2 Texture Mapping A way of adding urface detail Texture Mapping Jernej Barbic Univerity of Southern California Texture Mapping + Shading Filtering and Mipmap Non-color

More information

Shading. Flat shading Gouraud shading Phong shading

Shading. Flat shading Gouraud shading Phong shading Shading Flat shading Gouraud shading Phong shading Flat Shading and Perception Lateral inhibition: exaggerates perceived intensity Mach bands: perceived stripes along edges Icosahedron with Sphere Normals

More information

CS212. OpenGL Texture Mapping and Related

CS212. OpenGL Texture Mapping and Related CS212 OpenGL Texture Mapping and Related Basic Strategy Three steps to applying a texture 1. specify the texture read or generate image assign to texture enable texturing 2. assign texture coordinates

More information

Scene Graphs. CS4620/5620: Lecture 7. Announcements. HW 1 out. PA 1 will be out on Wed

Scene Graphs. CS4620/5620: Lecture 7. Announcements. HW 1 out. PA 1 will be out on Wed CS4620/5620: Lecture 7 Scene Graphs 1 Announcements HW 1 out PA 1 will be out on Wed Next week practicum will have an office hour type session on Open GL 2 Example Can represent drawing with flat list

More information

CSE 167: Introduction to Computer Graphics Lecture #8: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

CSE 167: Introduction to Computer Graphics Lecture #8: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017 CSE 167: Introduction to Computer Graphics Lecture #8: Textures Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017 Announcements Project 2 is due this Friday at 2pm Next Tuesday

More information

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

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

More information

Fundamentals of Computer Graphics Lecture 7 Visual realism Part 1: Lighting and rendering Yong-Jin Liu liuyongjin@tsinghua.edu.cn Material by S.M.Lea (UNC) Visual Realism Requirements Light Sources Materials

More information

Methodology for Lecture

Methodology for Lecture Basic Geometry Setup Methodology for Lecture Make mytest1 more ambitious Sequence of steps Demo Review of Last Demo Changed floor to all white, added global for teapot and teapotloc, moved geometry to

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

Textures. Datorgrafik 2006

Textures. Datorgrafik 2006 Textures Datorgrafik 2006 Reading Material MUST read These slides OH 139-172 by Magnus Bondesson Texturing, mipmapping, multitexturing, environment mapping OH 173-174 Bump mapping OH 175-200 3D-textures,

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

Computational Strategies

Computational Strategies Computational Strategies How can the basic ingredients be combined: Image Order Ray casting (many options) Object Order (in world coordinate) splatting, texture mapping Combination (neither) Shear warp,

More information

Lectures Display List

Lectures Display List Lectures Display List 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 it? What

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

Graphics Processing Units (GPUs) V1.2 (January 2010) Outline. High-Level Pipeline. 1. GPU Pipeline:

Graphics Processing Units (GPUs) V1.2 (January 2010) Outline. High-Level Pipeline. 1. GPU Pipeline: Graphics Processing Units (GPUs) V1.2 (January 2010) Anthony Steed Based on slides from Jan Kautz (v1.0) Outline 1. GPU Pipeline: s Lighting Rasterization Fragment Operations 2. Vertex Shaders 3. Pixel

More information