Computer graphics MN1
|
|
- Marlene Snow
- 5 years ago
- Views:
Transcription
1 Computer graphics MN1 Todays lecture What is OpenGL? HowdoI useit? Rendering pipeline Points, vertices, lines, polygons Matrices and transformations Lighting and shading Code examples OpenGL Open Graphics Library Graphics API similar to DirectX, Java3D OpenGL 2.0 released September 2004 Delivered with UNIX, Win9x/2000/Me/Nt/Xp, Mac OS Utilizes the window system and event handling of the OS Often hardware supported in graphics cards Language bindings to C, C++, Java, Fortran, Python, Perl, Toolkits GLU (OpenGL Utility Library) Support for NURBS, Quadrics, etc. Delivered with OpenGL GLUT (OpenGL Utility Toolkit) Simplifies window handling User interface functions Can be downloaded from opengl.org OpenGL Extensions allows new hardware innovations to be accessible through OpenGL MESA Mesa is a 3-D graphics library with an API which is very similar to that of OpenGL. Mesa is not a licensed implementation of OpenGL and has not been tested by the OpenGL conformance tests. You can consider Mesa to be OpenGL ; you can use OpenGL documentation, for example. Goals for OpenGL Industry-wide acceptance Consistent implementations Innovative implementations Long life High quality 1
2 Why/Why not OpenGL + Supporting OS + Open (kind of) + Free versions (Mesa) + Widely used - Can be hard to use in structured programming. State machine. A good idea is to wrap OpenGL into objects. Application program Pipeline Transform Project Clip Pixel operations Frame buffer Pipeline State machine OpenGL is designed as a state machine Input and outputs (geometric primitives, bitmaps) The state machine converts the inputs to an output image The resulting image depends on the current state Example: colors, shading, texture, Primitives in OpenGL OpenGL is using a right hand system Vertices are defined using glvertex*() where * can be 2f, 2d, 3f, 3d,... Ex.: void glvertex2f( GLfloat vx, GLfloat vy ); GLfloat typedefined as float Primitive defining statements all starts with glbegin(<primitive_type>) and ends with glend() Colors, normals, texture coordinates can be specified for each vertex 2
3 Primitives in OpenGL Some primitive types GL_POINTS GL_LINES GL_LINESTRIP GL_TRIANGLES GL_QUADS GL_POLYGON Example 1 Example 2 glbegin(gl_line_loop); 4 3 glbegin(gl_line_strip); 4 3 glvertex2f(-0.5,-0.5); // 1 glvertex2f(-0.5,-0.5); // 1 glvertex2f( 0.5,-0.5); // 2 glvertex2f( 0.5,-0.5); // 2 glvertex2f( 0.5, 0.5); // 3 glvertex2f( 0.5, 0.5); // 3 glvertex2f(-0.5, 0.5); // glvertex2f(-0.5, 0.5); //
4 Example Example 3 glbegin(gl_triangle_strip); glvertex3f(-0.5,-0.5,0.0); // 1 glvertex3f(0.5,-0.5,0.0); // 2 6 glvertex3f(-0.5,-0.5,0.0); // 1 glvertex3f(0.5,-0.5,0.0); // 2 4 glvertex3f(0.25, 0.5,0.0); // 3 glvertex3f(-0.5, 1.25, 0.0); // 4 3 glvertex3f(0.25, 0.5,0.0); // 3 glvertex3f(0.5, 0.75, 0.0); // 4 3 glvertex3f(0.5, 1.25, 0.0); // 5 glvertex3f(0.25, 0.75, 0.0); // Color Color per vertex glcolor3f(1.0,0.0,0.0); // red glvertex3f(); glcolor3f(); glvertex3f(); glcolor3f(); glvertex3f(); glcolor3f(); glnormal3f(); glvertex3f(); glcolor3f(); glnormal3f(); glvertex3f(); Normals glcolor3f(); gltexcoord2f(); glnormal3f(); glvertex3f(); Texture coordinates 4
5 Transformations OpenGL provides matrix stacks Two most important stacks: GL_MODELVIEW GL_PROJECTION We also have GL_TEXTURE and GL_COLOR Have to select which transformation matrix to modify: glmatrixmode( mode ) The current transformation matrix is the product of the above The matrices are 4x4 Transformations To set the matrix we can use or glloadmatrixf( GLfloat *ptr ); Rotation, translation, and scaling glrotatef(angle, vx, vy, vz); gltranslatef(dx, dy, dz); glscalef(sx, sy, sz); Your own matrix glmultmatrixf( GLfloat *ptr ); Example: Rotation about a line glmatrixmode(gl_modelview); // identity matrix gltranslatef(4.0, 5.0, 6.0); glrotatef(45.0, 1.0, 2.0, 3.0); gltranslatef(-4.0, -5.0, -6.0); C=T(4.0,5.0,6.0) R(45,1.0,2.0,3.0) T(-4.0,-5.0,-6.0) q=cp The transformation specified last is the one applied first Camera model Position Direction (look at) View up vector glulookat(eyex, eyey, eyez, atx, aty, atz, upx, upy, upz); eye up at Projections Projections Orthographic projection glortho(left, right, bottom, top, near, far); Perspective projection glfrustum(xmin, xmax, ymin, ymax, near, far); gluperspective(fovy,aspect,near,far); 5
6 Example glmatrixmode( GL_PROJECTION ); gluperspective(65.0, 1.0, 1.0, 20.0 ); glmatrixmode (GL_MODELVIEW ); glulookat(1,-4,-4,0,0,0,0,1,0); Callback functions Used for input and interaction The user submits a pointer to a function that should be called when the corresponding event occurs GLUT provides an easy-to-use interface Callback functions A very simple program (program1.cpp) glutmousefunc(function); // click mouse glutmotionfunc(function); // move mouse (button pressed) glutpassivemotionfunc(function); // (no button pressed) glutreshapefunc(function); // window resize glutkeyboardfunc(function); // keyboard glutspecialfunc(function); // arrows, pgup, pgdwn, etc. glutidlefunc(function); // animation glutdisplayfunc(function); // draw primitives #ifdef WIN32 #include <windows.h> #endif #include <GL/gl.h> #include <GL/glut.h> using namespace std; void initglut( int &argc, char **argv) glutinit( &argc,argv ); glutinitdisplaymode( GLUT_SINGLE GLUT_RGB ); glutinitwindowsize( 700, 700 ); glutinitwindowposition( 100, 100 ); glutcreatewindow( Program1 ); void initgl() glclearcolor( 0.0, 0.0, 0.0, 0.0 ); glmatrixmode( GL_PROJECTION ); glortho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0 ); glmatrixmode (GL_MODELVIEW ); 6
7 void draw() float point2[2] = 0.5, 0.75; glclear( GL_COLOR_BUFFER_BIT ); glcolor3f( 1.0, 1.0, 1.0 ); glbegin( GL_POLYGON ); glvertex2f( 0.25, 0.25 ); glvertex2fv( point2 ); glvertex2f( 0.75, 0.5 ); glvertex2f( 0.5, 0.5 ); glflush(); int main(int argc, char **argv) initglut(argc, argv); initgl(); // Set the display callback function to draw(). glutdisplayfunc( draw ); //Start the GLUT main Loop. glutmainloop(); return 0; Z-Buffering void initglut( int &argc, char **argv) glutinit( &argc,argv ); glutinitdisplaymode( GLUT_SINGLE GLUT_RGB GLUT_DEPTH); // z-buffer glutinitwindowsize( 700, 700 ); glutinitwindowposition( 100, 100 ); glutcreatewindow( TITLE ); Z-Buffering Z-Buffering void initgl() glclearcolor( 0.0, 0.0, 0.0, 0.0 ); glmatrixmode( GL_PROJECTION ); glortho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0 ); glmatrixmode (GL_MODELVIEW ); // Enable z-buffering glenable(gl_depth_test); void draw() glclear( GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT ); glvertex3f(); glflush(); 7
8 Lightsources and shading // lighting glenable(gl_lighting); glenable(gl_light0); // 0-GL_MAX_LIGHTS (3377) // set position, colors, direction, distance attenuation gllightfv(gl_light0, ); // shading glshademodel(gl_smooth); // Gouraud shading //glshademodel(gl_flat); Material properties Use material instead of color per face or vertex Set ambient, diffuse, specular, emission and shininess You can use color per face or vertex with glenable(gl_color_material); glmaterialfv(gl_front, GL_DIFFUSE, diff_ptr); glmaterialfv(gl_front, GL_SPECULAR, spec_ptr); glmateriali(gl_front, GL_SHININESS, 100); // culling glenable(gl_cull_face); glcullface(gl_back); Display lists in OpenGL Allows to store OpenGL commands in a list to be called later. Example: generation of a sphere Assume we have the function generatesphere() that computes coordinates of a unit sphere using sines and cosines. Display lists in OpenGL void generatesphere() for (j=0;j<n/2;j++) t1 = phi1 + j * (phi2 - phi1) / (n/2); t2 = phi1 + (j + 1) * (phi2 - phi1) / (n/2); for (i=0;i<=n;i++) t3 = theta1 + i * (theta2 - theta1) / n; e.x = cos(t1) * cos(t3); e.y = sin(t1); e.z = cos(t1) * sin(t3); p.x = c.x + r * e.x; p.y= c.y+ r * e.y; p.z= c.z+ r * e.z; glnormal3f(e.x,e.y,e.z); gltexcoord2f(i/(double)n,2*j/(double)n); glvertex3f(p.x,p.y,p.z); Display lists in OpenGL void initgl() list = glgenlists(1); glnewlist(list, GL_COMPILE); generatesphere(); glendlist(); void display() glcalllist(list); teapot.cpp void initgl() glclearcolor( 0.0, 0.0, 0.0, 0.0 ); // Setting up camera intrinsic parameters. glmatrixmode( GL_PROJECTION ); gluperspective(65.0, 1.0, 1.0, 20.0 ); // Setting up camera extrinsic parameters. glmatrixmode (GL_MODELVIEW ); glulookat(1,-4,-4,0,0,0,0,1,0); glenable(gl_depth_test); glshademodel( GL_SMOOTH ); // set up texture mapping glenable(gl_texture_2d); // load the texture LoadGLTextures("textures/copper.bmp", &ourtexture); 8
9 // set up lighting glenable(gl_lighting); glenable(gl_light1); gllightfv(gl_light1, GL_AMBIENT, light1ambient); gllightfv(gl_light1, GL_DIFFUSE, light1diffuse); gllightfv(gl_light1, GL_SPECULAR, light1specular); gllightfv(gl_light1, GL_POSITION, light1position); // set up material properties // (in this demo we have only one object, otherwise // you should specify material properties for each object) glmaterialfv(gl_front, GL_AMBIENT, mat_ambient); glmaterialfv(gl_front, GL_DIFFUSE, mat_diffuse); glmaterialfv(gl_front, GL_SPECULAR, mat_specular); glmaterialfv(gl_front, GL_EMISSION, mat_emission); glmateriali(gl_front, GL_SHININESS, mat_shininess); // display function void draw() glclear( GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT ); glpushmatrix(); glrotatef(anglex,0,1,0); glrotatef(-angley,1,0,0); // draw teapot glutsolidteapot(1.0); glpopmatrix(); glflush(); glutswapbuffers(); // mouse callback // btn = mouse button // state = up or down // x,y = window coords void mouse(int btn, int state, int x, int y) grab_pos_x = x; grab_pos_y = y; // Mouse motion, use mouse movements to rotate the object // OBS! This is a SIMPLE test function. // In the ideal case the rotation would be view dependent. void mousemotion(int x, int y) anglex += (x-grab_pos_x)/2.0; if( anglex > ) anglex -= 360.0; else if( anglex < ) anglex += 360.0; angley += (y-grab_pos_y)/2.0; if( angley > ) angley -= 360.0; else if( angley < ) angley += 360.0; grab_pos_x = x; grab_pos_y = y; glutpostredisplay(); int main(int argc, char **argv) initglut(argc, argv); initgl(); // Set the callback functions. glutdisplayfunc( draw ); glutmousefunc(mouse); glutmotionfunc(mousemotion); //Start the GLUT main Loop. glutmainloop(); return 0; 9
10 Links The main page for reference, documentation, news, downloads, tutorials, etc. Nice tutorials (beginner to expert) See links on course homepage Books The standard reference books OpenGL Programming Guide `Red Book OpenGL Rererence Manual `Blue Book Available online (HTML,PDF) See links on course homepage Course book Interactive Computer Graphics: A Top-Down Approach with OpenGL - 3rd/4th Edition Hierarchical modeling Hierarchical modeling 10
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 informationOpenGL. 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 informationPrecept 2 Aleksey Boyko February 18, 2011
Precept 2 Aleksey Boyko February 18, 2011 Getting started Initialization Drawing Transformations Cameras Animation Input Keyboard Mouse Joystick? Textures Lights Programmable pipeline elements (shaders)
More informationBooks, 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 informationComputer 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 informationBooks, 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 informationOutline. 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 informationGraphics 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 informationAPI 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 informationLecture 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 informationUNIT 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// 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 informationGraphics 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 informationGraphics 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 informationIntroduction 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 informationERKELEY 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 informationBasic 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 informationIntroduction 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 informationIntroduction 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 informationProgramming with OpenGL Part 2: Complete Programs Computer Graphics I, Fall
Programming with OpenGL Part 2: Complete Programs 91.427 Computer Graphics I, Fall 2008 1 1 Objectives Refine first program Alter default values Introduce standard program structure Simple viewing 2-D
More informationIntroduction 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 informationTo 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 informationProgramming 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 informationOrder of Transformations
Order of Transformations Because the same transformation is applied to many vertices, the cost of forming a matrix M=ABCD is not significant compared to the cost of computing Mp for many vertices p Note
More informationModeling Transform. Chapter 4 Geometric Transformations. Overview. Instancing. Specify transformation for objects 李同益
Modeling Transform Chapter 4 Geometric Transformations 李同益 Specify transformation for objects Allow definitions of objects in own coordinate systems Allow use of object definition multiple times in a scene
More informationOpenGL for dummies hello.c #include int main(int argc, char** argv) { glutinit(&argc, argv); glutinitdisplaymode (GLUT_SINGLE GLUT_RGB); glutinitwindowsize (250, 250); glutinitwindowposition
More informationComputer 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 informationBasic 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 informationComputer 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 informationRECITATION - 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 informationC 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 informationInteraction Computer Graphics I Lecture 3
15-462 Computer Graphics I Lecture 3 Interaction Client/Server Model Callbacks Double Buffering Hidden Surface Removal Simple Transformations January 21, 2003 [Angel Ch. 3] Frank Pfenning Carnegie Mellon
More informationCS559: Computer Graphics. Lecture 12: OpenGL Transformation Li Zhang Spring 2008
CS559: Computer Graphics Lecture 2: OpenGL Transformation Li Zhang Spring 28 Today Transformation in OpenGL Reading Chapter 3 Last time Primitive Details glpolygonmode(glenum face, GLenum mode); face:
More information11/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 informationLecture 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 informationCS559: 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 informationTeacher 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 informationCS 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 informationCS 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 information2 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 informationCS 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 informationComputer 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 informationGraphics Programming
Graphics Programming 3 rd Week, 2011 OpenGL API (1) API (application programming interface) Interface between an application program and a graphics system Application Program OpenGL API Graphics Library
More informationLecture 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 informationOpenGL/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 informationAn Interactive Introduction to OpenGL and OpenGL ES Programming. Ed Angel Dave Shreiner
An Interactive Introduction to OpenGL and OpenGL ES Programming Ed Angel Dave Shreiner Welcome This morning s Goals and Agenda Describe the OpenGL APIs and their uses Demonstrate and describe OpenGL s
More informationComputer Graphics Introduction to OpenGL
Computer Graphics 2015 3. Introduction to OpenGL Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2015-09-28 2. 2D Graphics Algorithms (cont.) Rasterization Computer Graphics @ ZJU Hongxin Zhang,
More informationUnderstand 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 informationLecture 3. Understanding of OPenGL programming
Lecture 3 Understanding of OPenGL programming What is OpenGL GL: stands for Graphic Library Software interface for rendering purposes for 2D or 3D geometric data objects. Various Pieces gl: The basic libraries.
More informationAn Interactive Introduction to OpenGL Programming
An Interactive Introduction to OpenGL Programming Course # 29 Dave Shreiner Ed Angel Vicki Shreiner Table of Contents Introduction...iv Prerequisites...iv Topics...iv Presentation Course Notes...vi An
More informationComputer Graphics Primitive Attributes
Computer Graphics 2015 4. Primitive Attributes Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2015-10-12 Previous lessons - Rasterization - line - circle /ellipse? => homework - OpenGL and
More informationComputer 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 informationComputer Graphics, Chapt 08
Computer Graphics, Chapt 08 Creating an Image Components, parts of a scene to be displayed Trees, terrain Furniture, walls Store fronts and street scenes Atoms and molecules Stars and galaxies Describe
More informationProgramming with OpenGL Part 1: Background
Programming with OpenGL Part 1: Background Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Objectives Development of the OpenGL API
More informationIntroduction to OpenGL Week 1
CS 432/680 INTERACTIVE COMPUTER GRAPHICS Introduction to OpenGL Week 1 David Breen Department of Computer Science Drexel University Based on material from Ed Angel, University of New Mexico Objectives
More informationObjectives. Image Formation Revisited. Physical Approaches. The Programmer s Interface. Practical Approach. Introduction to OpenGL Week 1
CS 432/680 INTERACTIVE COMPUTER GRAPHICS Introduction to OpenGL Week 1 David Breen Department of Computer Science Drexel University Objectives Learn the basic design of a graphics system Introduce graphics
More informationOpenGL 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 informationLectures 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 informationVisualizing 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 informationHierarchical 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 informationExercise 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 informationCSC 470 Computer Graphics
CSC 470 Computer Graphics Transformations of Objects CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 1 Transformations of objects - 2D CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 2 Using
More informationInteraction. CSCI 480 Computer Graphics Lecture 3
CSCI 480 Computer Graphics Lecture 3 Interaction January 18, 2012 Jernej Barbic University of Southern California Client/Server Model Callbacks Double Buffering Hidden Surface Removal Simple Transformations
More informationSource code: #include <iostream>
Andrew Yenalavitch Homework 4 CSE 520 - Winter 2015 1. ( 10 points ) Write a program that finds the knot vector ( u 0,..., u n-1 ) of a B-spline. It asks for 'number of control points' and 'degree of spline'
More informationGL_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 information1 /* 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 informationRASTERISED RENDERING
DH2323 DGI17 INTRODUCTION TO COMPUTER GRAPHICS AND INTERACTION RASTERISED RENDERING Christopher Peters CST, KTH Royal Institute of Technology, Sweden chpeters@kth.se http://kth.academia.edu/christopheredwardpeters
More informationComputer Graphics. Chapter 10 Three-Dimensional Viewing
Computer Graphics Chapter 10 Three-Dimensional Viewing Chapter 10 Three-Dimensional Viewing Part I. Overview of 3D Viewing Concept 3D Viewing Pipeline vs. OpenGL Pipeline 3D Viewing-Coordinate Parameters
More informationCOMP 371/4 Computer Graphics Week 1
COMP 371/4 Computer Graphics Week 1 Course Overview Introduction to Computer Graphics: Definition, History, Graphics Pipeline, and Starting Your First OpenGL Program Ack: Slides from Prof. Fevens, Concordia
More informationOpenGL. Jimmy Johansson Norrköping Visualization and Interaction Studio Linköping University
OpenGL Jimmy Johansson Norrköping Visualization and Interaction Studio Linköping University Background Software interface to graphics hardware 250+ commands Objects (models) are built from geometric primitives
More informationComputer 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 informationTransformation, Input and Interaction. Hanyang University
Transformation, Input and Interaction Hanyang University Transformation, projection, viewing Pipeline of transformations Standard sequence of transforms Cornell CS4620 Fall 2008 Lecture 8 3 2008 Steve
More informationOpenGL. 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 informationC++ 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 informationScientific Visualization Basics
Scientific Visualization Basics Aiichiro Nakano Collaboratory for Advanced Computing & Simulations Dept. of Computer Science, Dept. of Physics & Astronomy, Dept. of Chemical Engineering & Materials Science,
More informationComputer Graphics. Chapter 7 2D Geometric Transformations
Computer Graphics Chapter 7 2D Geometric Transformations Chapter 7 Two-Dimensional Geometric Transformations Part III. OpenGL Functions for Two-Dimensional Geometric Transformations OpenGL Geometric Transformation
More informationPearce Outline. OpenGL Background and History. Other Graphics Technology. Platform Specifics. The Drawing Process
Outline 433-380 Graphics and Computation Introduction to OpenGL OpenGL Background and History Other Graphics Technology Drawing Viewing and Transformation Lighting JOGL and GLUT Resources Some images in
More informationDisplay Lists in OpenGL
Display Lists in OpenGL Display lists are a mechanism for improving performance of interactive OpenGL applications. A display list is a group of OpenGL commands that have been stored for later execution.
More informationTransformation Pipeline
Transformation Pipeline Local (Object) Space Modeling World Space Clip Space Projection Eye Space Viewing Perspective divide NDC space Normalized l d Device Coordinatesd Viewport mapping Screen space Coordinate
More informationCOMPUTER GRAPHICS LAB # 3
COMPUTER GRAPHICS LAB # 3 Chapter 2: COMPUTER GRAPHICS by F.S HILLs. Initial steps in drawing figures (polygon, rectangle etc) Objective: Basic understanding of simple code in OpenGL and initial steps
More informationShading 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 information1 (Practice 1) Introduction to OpenGL
1 (Practice 1) Introduction to OpenGL This first practical is intended to get you used to OpenGL command. It is mostly a copy/paste work. Try to do it smartly by tweaking and messing around with parameters,
More informationVR-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 information5.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 informationLecture 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 information2/3/16. Interaction. Triangles (Clarification) Choice of Programming Language. Buffer Objects. The CPU-GPU bus. CSCI 420 Computer Graphics Lecture 3
CSCI 420 Computer Graphics Lecture 3 Interaction Jernej Barbic University of Southern California [Angel Ch. 2] Triangles (Clarification) Can be any shape or size Well-shaped triangles have advantages for
More informationInteraction. CSCI 420 Computer Graphics Lecture 3
CSCI 420 Computer Graphics Lecture 3 Interaction Jernej Barbic University of Southern California Client/Server Model Callbacks Double Buffering Hidden Surface Removal Simple Transformations [Angel Ch.
More informationToday 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 informationIntroduction to OpenGL
CS100433 Introduction to OpenGL Junqiao Zhao 赵君峤 Department of Computer Science and Technology College of Electronics and Information Engineering Tongji University Before OpenGL Let s think what is need
More informationby modifying the glutinitwindowsize() function you can change the screen size to whatever you please.
Zoe Veale Lab 2 Draw2 part 1: I edited the glutinitwindowsize() function tom change the size of my screen window. int main(int argc, char** argv) glutinit(&argc, argv); //initialize toolkit glutinitdisplaymode
More informationRendering 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 informationCSC Graphics Programming. Budditha Hettige Department of Statistics and Computer Science
CSC 307 1.0 Graphics Programming Department of Statistics and Computer Science Graphics Programming OpenGL 3D Drawing 2 3D Graphics Projections Getting 3D to 2D 3D scene 2D image 3 Projections Orthographic
More informationIntroduction to OpenGL. CSCI 4229/5229 Computer Graphics Fall 2012
Introduction to OpenGL CSCI 4229/5229 Computer Graphics Fall 2012 OpenGL by Example Learn OpenGL by reading nehe.gamedev.net Excellent free tutorial Code available for many platforms and languages OpenGL:
More informationGraphics Programming. August 31, Programming of the Sierpinski gasket. Programming with OpenGL and C/C++
Computer Graphics Graphics Programming August 31, 2005 Contents Our Goal in This Chapter Programming of the Sierpinski gasket How To? Programming with OpenGL and C/C++ OpenGL API (Application Programmer
More informationCS 4731 Lecture 3: Introduction to OpenGL and GLUT: Part II. Emmanuel Agu
CS 4731 Lecture 3: Introduction to OpenGL and GLUT: Part II Emmanuel Agu Recall: OpenGL Skeleton void main(int argc, char** argv){ // First initialize toolkit, set display mode and create window glutinit(&argc,
More information20 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 informationComputer Graphics CS 543 Lecture 5 (Part 2) Implementing Transformations
Computer Graphics CS 543 Lecture 5 (Part 2) Implementing Transformations Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Objectives Learn how to implement transformations
More informationIllumination 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 informationComputer 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 informationCS 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