Computer Graphics 1 Computer Graphics 1
|
|
- Lewis Clark
- 5 years ago
- Views:
Transcription
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 system independent close to hardware 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 1 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 2 Various Transformations Pipeline Model How many transformations can you fit in a graphics pipeline? lots Direct implementation of synthetic camera Image formation by computer is analogous to image formation by camera (or human) Specify viewer, objects, lights Let hardware/software form image (via projection) 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 3 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 4 OpenGL Geometric Pipeline OpenGL Architecture State Application ModelView Program Transformation Projection Rasterization Frame Buffer Polynomial Evaluator Per Vertex Operations & Primitive Assembly Vertices Pixels Traditional path for geometric, vertex based primitives. CPU Display List Rasterization Per Fragment Operations Frame Buffer Pixel Operations Texture Memory 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 5 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 6 1
2 Geometric primitives points, lines and polygons Image Primitives images and bitmaps separate pipeline for images and geometry linked through texture mapping Rendering depends on state colors, materials, light sources, etc. OpenGL as a Renderer OpenGL and the Windowing System OpenGL is concerned only with rendering Window system independent No input functions OpenGL must interact with underlying OS and windowing system Need minimal interface which may be system dependent Done through additional libraries: AGL, GLX, WGL 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 7 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 8 GLU and GLUT OpenGL and Related APIs GLU (OpenGL Utility Library) part of OpenGL NURBS, tessellators, quadric shapes, etc. GLUT (OpenGL Utility Toolkit) portable windowing API not officially part of OpenGL OpenGL Motif widget or similar GLX, AGL or WGL X, Win32, Mac O/S application program GLUT GLU GL software and/or hardware 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 9 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 10 Preliminaries Header Files #include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h> Libraries Enumerated Types OpenGL defines numerous types for compatibility GLfloat, GLint, GLenum, etc. Application Structure Configure and open window Initialize OpenGL state Register input callback functions render resize input: keyboard, mouse, etc. Enter event processing loop GLUT Basics 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 11 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 12 2
3 Sample Program OpenGL Initialization void main( int argc, char** argv ){ int mode = GLUT_RGB GLUT_DOUBLE; glutinitdisplaymode( mode ); glutcreatewindow( argv[0] ); init(); glutdisplayfunc( display ); glutreshapefunc( resize ); glutkeyboardfunc( key ); glutidlefunc( idle ); glutmainloop(); Set up whatever state you re going to use void init( void ) { glclearcolor( 0.0, 0.0, 0.0, 1.0 ); glcleardepth( 1.0 ); /* Don t do this for Project 1!! */ glenable( GL_LIGHT0 ); glenable( GL_LIGHTING ); glenable( GL_DEPTH_TEST ); 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 13 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 14 GLUT Callback Functions Routine to call when something happens window resize or redraw user input animation Register callbacks with GLUT glutdisplayfunc( display ); glutidlefunc( idle ); glutkeyboardfunc( keyboard ); Do all of your drawing here glutdisplayfunc( display ); void display( void ){ glclear( GL_COLOR_BUFFER_BIT ); glbegin( GL_TRIANGLE_STRIP ); glvertex3fv( v[0] ); glvertex3fv( v[1] ); glvertex3fv( v[2] ); glvertex3fv( v[3] ); /*MAY NEED glflush();*/ glutswapbuffers(); Rendering Callback 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 15 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 16 Use for animation and continuous update glutidlefunc( idle ); Idle Callbacks User Input Callbacks Process user input glutkeyboardfunc( keyboard ); void idle( void ){ t += dt; glutpostredisplay(); void keyboard( char key, int x, int y ){ switch( key ) { case q : case Q : exit( EXIT_SUCCESS ); break; case r : case R : rotate = GL_TRUE; break; 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 17 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 18 3
4 Geometric Primitives Managing OpenGL State OpenGL Buffers Elementary Rendering OpenGL Geometric Primitives All GL geometry is specified by vertices GL_POINTS GL_LINES GL_LINE_STRIP GL_LINE_LOOP GL_POLYGON GL_TRIANGLES GL_TRIANGLE_STRIP GL_TRIANGLE_FAN GL_QUADS GL_QUAD_STRIP 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 19 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 20 Simple Example OpenGL Command Formats void drawrhombus( GLfloat color[] ){ glbegin( GL_QUADS ); glcolor3fv( color ); glvertex2f( 0.0, 0.0 ); glvertex2f( 1.0, 0.0 ); glvertex2f( 1.5, ); glvertex2f( 0.5, ); (0,2) Number of components 2 - (x,y) 3 - (x,y,z) 4 - (x,y,z,w) glvertex3fv( v ) Data Type b - byte ub - unsigned byte s - short us - unsigned short i - int ui - unsigned int f - float d - double Vector omit v for scalar form glvertex2f( x, y ) (0,0) (2,0) 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 21 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 22 Specifying Geometric Primitives Primitives are specified using glbegin( primtype ); primtype determines how vertices are combined GLfloat red, green, blue; Glfloat coords[3]; glbegin( primtype ); for ( i = 0; i < nverts; ; ++i ) { glcolor3f( red, green, blue ); glvertex3fv( coords ); RGBA or Color Index color index mode Red Green Blue RGBA mode OpenGL Color Models Display 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 23 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 24 4
5 C standard C++ OK but OpenGL not object oriented Fortran binding exists Java is getting there Language Bindings Interactive Computer Graphics Real power of computer graphics Display is altered in response to User input Helps user Understand data Perceive trends Visualize real/imaginary objects Manage program - GUI Feedback key ingredient! Response letting user know how input was interpreted 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 25 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 26 Graphical User Interface (GUI) Tasks: Dragging continuous movement of graphical object according to input Rubberbanding one end fixed, the other wherever cursor currently is Inking trail of line segments drawn according to input movement Constraints Menu Kinds of feedback? Positioning Spatial: Moving Cursor Linguistic: Specifying X, Y values Selecting Entering Text Entering Numeric Quantities Dials, Sliders Basic Interaction Tasks 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 27 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 28 How to handle transition for Positioning Selection Rotation 2D to 3D Device Mapping Possibilities Multiple Views Hierarchy Traversal Direct Input 3D Interactive Graphics Versus Polling Event Transition in control state of system Event Record Record of system activity Data structure Which event Data corresponding to event Stored in Event Queue Event Handling 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 29 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 30 5
6 Managed by OS Keeps track of sequence Resources for process to deal with event Events are posted to it Front of queue passed to process that owns it May be based on location Event Queue Event Loop Main program Contains Event Handler that invokes callback function that has been registered for the event that is on the front of the Event Queue 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 31 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 32 Event Handling Program Events Initialization functions Action functions Callback functions Main event loop Invokes event handler Determines which callback, if any Passes control to that event handler When done, control back to event handler Direct control of program has been removed from the program itself and moved to the USER!!!! Events Keypress Mouse Motion Examples KeyDown KeyUp leftbuttondown leftbuttonup With mouse press Without In OpenGL glutkeyboardfunc glutmousefunc glutmotionfunc glutpassivemotionfunc 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 33 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 34 Events Glut Menu Creation Events Window System Software Examples Moving Resizing idle timer What to draw In OpenGL glutreshapefunc glutidlefunc gluttimerfunc glutdisplayfunc typedef enum{ OPTION_1, OPTION_2 menu_entries; void menu_selected(int entry); void mouse_clicked(int button,int state,int x,int y);... void init() {... glutcreatemenu(menu_selected); glutaddmenuentry("option 1",OPTION_1); glutaddmenuentry("option 2",OPTION_2); glutattachmenu(glut_right_button); glutmousefunc(mouse_clicked);... 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 35 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 36 6
7 Coordinate Systems Raster display and drawing system coordinates may not always be identical: Coordinate Systems OpenGL uses right side up coordinates (0,0) is at bottom left Coordinates increase to the right and up Dimensions set in call to glutinitwindowsize() 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 37 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 38 OpenGL State OpenGL programs run in an environment controlled by the OpenGL state Primarily, characteristics line width, current color, etc. State variables maintain their values until changed Part of the state controls the way in which OpenGL calls cause pixels to be written Simplest way to set this up: glmatrixmode( GL_PROJECTION ); glloadidentity(); gluortho2d( 0, 640.0, 0, ); Drawing in OpenGL Can draw more complex figures as combinations of simpler figures: void hardwiredhouse(void) { glbegin(gl_line_loop); glvertex2i(40, 40); glvertex2i(40, 90); glvertex2i(70, 120); glvertex2i(100, 90); glvertex2i(100, 40); glbegin(gl_line_strip); glvertex2i(50, 100); glvertex2i(50, 120); glvertex2i(60, 120); glvertex2i(60, 110); // draw the door // draw the window 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 39 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 40 To change the line width, use: Displaying Line Widths To create a line pattern use: Displaying Line Styles gllinewidth (Glfloat width); Width must be greater than 0.0 and default is 1.0. Line rendering is affected by antialiasing mode. gllinewidth(4); glbegin(gl_lines); glvertex2i(50, 50); glvertex2i(100, 150); gllinestipple(glint factor, Glushort pattern); The pattern is a 16 bit series of 0s and 1 s, beginning with the low-order bit of the pattern. Each bit of pattern is stretched out by a multiple of factor. gllinestipple(1, 0x3F07); glenable(gl_line_stipple); glbegin(gl_lines); glvertex2i(50, 150); glvertex2i(100, 150); 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 41 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 42 7
8 Displaying Line Styles Displaying Text To display a bitmapped font use: glutbitmapcharacter(void *font, int character); The character is displayed at the current raster position. Use glrasterpos*() to reposition cursor before drawing. glrasterpos2i(100, 100); glutbitmapcharacter(glut_bitmap_times_roman_24, B ); Supported bitmap fonts include: GLUT_BITMAP_8_BY_13 GLUT_BITMAP_9_BY_15 GLUT_BITMAP_TIMES_ROMAN_10 GLUT_BITMAP_TIMES_ROMAN_24 GLUT_BITMAP_HELVETICA_10 GLUT_BITMAP_HELVETICA_12 GLUT_BITMAP_HELVETICA_18 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 43 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 44 OpenGL supports some built-in polygon routines: Polygons glrecti( GLInt x1, GLint y1, GLint x2, GLint y2 ); Draws aligned rectangle with opposite corners (x1,y1) and (x2,y2) Sides are aligned with the coordinate axes Can also draw as a series of vertices: glbegin( GL_POLYGON ); glvertex2f( x0, y0 ); glvertex2f( x1, y1 ); glvertex2f( xn, yn ); Polygons 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 45 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 46 Polygons A polygon is convex if a line connecting any two points of the polygon lies entirely within it. Filled Polygons Convex polygons can be automatically filled with a pattern. 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 47 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 48 8
9 To fill a convex polygon use: Displaying Filled Polygons Displaying Filled Polygons glpolygonstipple(const Glubyte *mask); The pattern is a 32x32 (128 bytes) bitmap interpreted as a mask of 0 s and 1 s. For each byte, the most significant bit is first. glenable (GL_POLYGON_STIPPLE); glpolygonstipple (pattern); gldisable(gl_polygon_stipple); GLubyte pattern[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x01, 0xC0, 0x06, 0xC0, 0x03, 0x60, 0x04, 0x60, 0x06, 0x20, 0x04, 0x30, 0x0C, 0x20, 0x04, 0x18, 0x18, 0x20, 0x04, 0x0C, 0x30, 0x20, 0x04, 0x06, 0x60, 0x20, 0x44, 0x03, 0xC0, 0x22, 0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22, 0x66, 0x01, 0x80, 0x66, 0x33, 0x01, 0x80, 0xCC, 0x19, 0x81, 0x81, 0x98, 0x0C, 0xC1, 0x83, 0x30, 0x07, 0xe1, 0x87, 0xe0, 0x03, 0x3f, 0xfc, 0xc0, 0x03, 0x31, 0x8c, 0xc0, 0x03, 0x33, 0xcc, 0xc0, 0x06, 0x64, 0x26, 0x60, 0x0c, 0xcc, 0x33, 0x30, 0x18, 0xcc, 0x33, 0x18, 0x10, 0xc4, 0x23, 0x08, 0x10, 0x63, 0xC6, 0x08, 0x10, 0x30, 0x0c, 0x08, 0x10, 0x18, 0x18, 0x08, 0x10, 0x00, 0x00, 0x08; 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 49 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 50 Mouse Callbacks Mouse presses and releases can be captured by: glutmousefunc(mymouse); // registered in main() void mymouse(int button, int state, int x, int y) { if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) { Likewise, mouse movements once a button is pressed can be captured by: glutmousefunc(mymovedmouse); // registered in main() Remember, the coordinate system in GLUT requires y values to be inverted (by the current height of the screen). Keyboard interaction is captured by: Keyboard Callbacks glutkeyboardfunc(mykeyboard); // registered in main() void mykeyboard(unsigned char key, int x, int y) { switch (key) { case a : // do something break; 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 51 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 52 Examples Lots of opengl examples: /usr/local/pub/ncs/graphics/opengl /usr/local/glut/progs /usr/local/glut/test 12/3/2004 CG1 - Introduction to OpenGL (v1.01) 53 9
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 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 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 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 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 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 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 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 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 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 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 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 informationInformation 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 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 informationComputer Graphics. Making Pictures. Computer Graphics CSC470 1
Computer Graphics Making Pictures Computer Graphics CSC470 1 Getting Started Making Pictures Graphics display: Entire screen (a); windows system (b); [both have usual screen coordinates, with y-axis y
More 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 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 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 informationDrawing Primitives. OpenGL basics
CSC 706 Computer Graphics / Dr. N. Gueorguieva 1 OpenGL Libraries Drawing Primitives OpenGL basics OpenGL core library OpenGL32 on Windows GL on most unix/linux systems (libgl.a) OpenGL Utility Library
More informationGLUT. What is OpenGL? Introduction to OpenGL and GLUT
What is OpenGL? Introduction to OpenGL and An application programming interface (API) A (low-level) Graphics rendering API Generate high-quality h color images composed of geometric and image primitives
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 2 Common Uses for Computer Graphics Applications for real-time 3D graphics range from interactive games
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 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 informationComputer 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 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 informationImage 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 informationCS 543 Lecture 1 (Part 3) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)
Computer Graphics CS 543 Lecture 1 (Part 3) Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Recall: OpenGL Skeleton void main(int argc, char** argv){ // First initialize
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 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 informationRendering. 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 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 information2. OpenGL -I. 2.1 What is OpenGL? Things OpenGL can do: -23-
2.1 What is OpenGL? -23-2. OpenGL -I - Device-independent, application program interface (API) to graphics hardware - 3D-oriented - Event-driven Things OpenGL can do: - wireframe models - depth-cuing effect
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 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 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 informationCSE 167: Introduction to Computer Graphics Lecture #5: Visibility, OpenGL
CSE 167: Introduction to Computer Graphics Lecture #5: Visibility, OpenGL Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016 Announcements Tomorrow: assignment 1 due Grading
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 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 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 GLUT 2 Events in OpenGL Event Example Keypress KeyDown KeyUp Mouse leftbuttondown leftbuttonup With mouse
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. 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 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 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 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 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 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 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 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 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 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 informationComputer Graphics Anatomy of GUI. Computer Graphics CSC470 1
Computer Graphics Anatomy of GUI 1 Anatomy of GLUT keyboard mouse OpenGL Application if (key == f key == F ) { glutfullscreen(); } else if(key == w key == W ) { glutreshapewindow(640,480); } display reshape
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 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 informationComputer Graphics (Basic OpenGL)
Computer Graphics (Basic OpenGL) Thilo Kielmann Fall 2008 Vrije Universiteit, Amsterdam kielmann@cs.vu.nl http://www.cs.vu.nl/ graphics/ Computer Graphics (Basic OpenGL, Input and Interaction), ((57))
More informationvoid drawdot(glint x, GLint y) { glbegin(gl_points); glvertex2i(x,y); glend();
CSC 706 Computer Graphics Primitives, Stippling, Fitting In OpenGL Primitives Examples: GL_POINTS GL_LINES GL_LINE_STRIP GL_POLYGON GL_LINE_LOOP GL_ TRIANGLES GL_QUAD_STRIP GL_TRIANGLE_STRIP GL_TRIANGLE_FAN
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 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 informationComputer Graphics (CS 4731) OpenGL/GLUT(Part 1)
Computer Graphics (CS 4731) Lecture 2: Introduction to OpenGL/GLUT(Part 1) Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Recall: OpenGL GLBasics OpenGL s function Rendering
More informationCS 543 Lecture 1 (Part II): Intro to OpenGL and GLUT (Part I) Emmanuel Agu
CS 543 Lecture 1 (Part II): Intro to OpenGL and GLUT (Part I) Emmanuel Agu OpenGL Basics OpenGL s function Rendering Rendering? Convert geometric/mathematical object descriptions into images OpenGL can
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 informationAssignment 1. Simple Graphics program using OpenGL
Assignment 1 Simple Graphics program using OpenGL In this assignment we will use basic OpenGL functions to draw some basic graphical figures. Example: Consider following program to draw a point on screen.
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 informationOpenGL Primitives. Examples: Lines. Points. Polylines. void drawdot(glint x, GLint y) { glbegin(gl_points); glvertex2i(x,y); glend(); }
CSC 706 Computer Graphics Primitives, Stippling, Fitting In Examples: OpenGL Primitives GL_POINTS GL_LINES LINES GL _ LINE _ STRIP GL_POLYGON GL_LINE_LOOP GL_TRIANGLES GL_QUAD_STRIP GL_TRIANGLE_STRIP GL_TRIANGLE_FAN
More informationAbel J. P. Gomes LAB. 1. INTRODUCTION TO OpenGL
Visual Computing and Multimedia Abel J. P. Gomes 1. Getting Started 2. Installing Graphics Libraries: OpenGL and GLUT 3. Setting up an IDE to run graphics programs in OpenGL/GLUT 4. A First OpenGL/GLUT
More informationCameras (and eye) Ideal Pinhole. Real Pinhole. Real + lens. Depth of field
Cameras (and eye) Ideal Pinhole Real Pinhole Real + lens Depth of field 1 Z-buffer How do we draw objects? Polygon Based Fast Raytracing Ray/Object intersections Slow Copyright Pixar 2 Raytracing for each
More informationOverview of Graphics Systems Hearn & Baker Chapter 2. Some slides are taken from Robert Thomsons notes.
Overview of Graphics Systems Hearn & Baker Chapter 2 Some slides are taken from Robert Thomsons notes. OVERVIEW Video Display Devices Raster Scan Systems Graphics Workstations and Viewing Systems Input
More informationProject Sketchpad. Ivan Sutherland (MIT 1963) established the basic interactive paradigm that characterizes interactive computer graphics:
Project Sketchpad Ivan Sutherland (MIT 1963) established the basic interactive paradigm that characterizes interactive computer graphics: User sees an object on the display User points to (picks) the object
More informationProgramming of Graphics
Peter Mileff PhD Programming of Graphics Introduction to OpenGL University of Miskolc Department of Information Technology OpenGL libraries GL (Graphics Library): Library of 2D, 3D drawing primitives and
More informationComputer graphic -- Programming with OpenGL I
Computer graphic -- Programming with OpenGL I A simple example using OpenGL Download the example code "basic shapes", and compile and run it Take a look at it, and hit ESC when you're done. It shows the
More informationCSC 8470 Computer Graphics. What is Computer Graphics?
CSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures can be generated using a computer. But it also includes: software tools used to make pictures hardware
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 informationCS621 Lab 1 Name: Ihab Zbib
CS621 Lab 1 Name: Ihab Zbib 1) The program draw.cpp draws two rectangles and two triangles. The program compiles and executes successfully. What follows are the snap shots of the output. Illustration 1:
More informationOpenGL Introduction Computer Graphics and Visualization
Fall 2009 2 OpenGL OpenGL System Interaction Portable Consistent visual display regardless of hardware, OS and windowing system Callable from Ada, C, C++, Fortran, Python, Perl and Java Runs on all major
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 informationAn 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 informationEarly History of APIs. PHIGS and X. SGI and GL. Programming with OpenGL Part 1: Background. Objectives
Programming with OpenGL Part 1: Background Early History of APIs Objectives Development of the OpenGL API OpenGL Architecture - OpenGL as a state machine Functions - Types -Formats Simple program IFIPS
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 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 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 informationComp 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 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 informationImage Rendering. Rendering can be divided into three sub-problems. Image Formation The hidden surface problem visibility determination steps
Image Rendering Rendering can be divided into three sub-problems Image Formation The hidden surface problem visibility determination steps Illumination Direct illumination Indirect illumination Shading
More informationLecture 4. Interaction / Graphical Devices. CS 354 Computer Graphics Sunday, January 20, 13
Lecture 4 Interaction / Graphical Devices Graphical Input Devices can be described either by - Physical properties Mouse Keyboard Trackball - Logical Properties What is returned to program via API A position
More informationCSE4030 Introduction to Computer Graphics
CSE4030 Introduction to Computer Graphics Dongguk University Jeong-Mo Hong Week 2 The first step on a journey to the virtual world An introduction to computer graphics and interactive techniques How to
More informationAnnouncements OpenGL. Computer Graphics. Autumn 2009 CS4815
Computer Graphics Autumn 2009 Outline 1 Labs 2 Labs Outline 1 Labs 2 Labs Labs Week02 lab Marking 8 10 labs in total each lab worth 2 3% of overall grade marked on attendance and completion of lab completed
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 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 informationAnnouncements OpenGL. Computer Graphics. Spring CS4815
Computer Graphics Spring 2017-2018 Outline 1 2 Tutes and Labs Tute02, vector review (see matrix) Week02 lab Lab Marking 10 labs in total each lab worth 3% of overall grade marked on attendance and completion
More informationto OpenGL Introduction Pipeline Graphics pipeline OpenGL pipeline OpenGL syntax Modeling Arrays Conclusion 1 Introduction Introduction to OpenGL
to to ning Lecture : introduction to Lab : first steps in and - 25/02/2009 Lecture/Lab : transformations and hierarchical - 04/03/2009 to Lecture : lights and materials in - 11/03/2009 Lab : lights and
More informationDraw the basic Geometry Objects. Hanyang University
Draw the basic Geometry Objects Hanyang University VERTEX ATTRIBUTE AND GEOMETRIC PRIMITIVES Vertex Vertex A point in 3D space, or a corner of geometric primitives such as triangles, polygons. Vertex attributes
More informationInput and Interaction
Input and Interaction Adapted from Edward Angel, UNM! Angel: Interactive Computer Graphics 3E Addison-Wesley 2002 Project Sketchpad Ivan Sutherland (MIT 1963) established the basic interactive paradigm
More informationGraphics and Visualization
International University Bremen Spring Semester 2006 Recap Display Devices First Lab Course OpenGL OpenGL is the premier environment for developing portable, interactive 2D and 3D graphics applications.
More informationComputer Graphics Introduction to OpenGL
Computer Graphics 2013 3. Introduction to OpenGL Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2013-09-16 2. 2D Graphics Algorithms (cont.) Rasterization Scan converting lines start
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 informationComputer Graphics. Downloaded from: LectureNotes 1 CSC-254
Computer Graphics Downloaded from: http://www.bsccsit.com LectureNotes 1 CSC-254 Lecture 1: Course Introduction Reading: Chapter 1 in Hearn and Baker. Computer Graphics: Computer graphics is concerned
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 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 informationGeometry Primitives. Computer Science Department University of Malta. Sandro Spina Computer Graphics and Simulation Group. CGSG Geometry Primitives
Geometry Primitives Sandro Spina Computer Graphics and Simulation Group Computer Science Department University of Malta 1 The Building Blocks of Geometry The objects in our virtual worlds are composed
More information