Computer Graphics. OpenGL
|
|
- Edward Wade
- 5 years ago
- Views:
Transcription
1 Computer Graphics OpenGL
2 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 and operations involved in producing high-quality graphical images, specifically colour images of three-dimensional objects.
3 OpenGL Features Used to draw graphics primitives in 2D & 3D Points Lines Polygons Also used in Lighting. Shading. Texture mapping. Animation. Other special effects.
4 Installation Install Microsoft Visual C++ You need to get glut.h glut32.dll glut32.lib Copy (glut.h) file into C:\Program Files\Microsoft Visual Studio\VC98\include\gl Put the DLL file (glut32.dll) in C:\WINDOWS\SYSTEM Put the library file (glut32.lib) into C:\Program Files\Microsoft Visual Studio\VC98\lib
5 How it works Start MS Visual Studio Select FILE NEW to create a new project Select Win32 Console Application, choose a project name, directory location, make sure create new workspace is checked then click OK. When asked what type of application to build select An Empty Project, then click Finish.
6 How it works Some settings should be changed so the project is linked to the OpenGL library files (Done only once in your PC) Select PROJECT SETTINGS from the main menu bar Change the Settings For option to All Configurations. Select the LINK tab Make sure category is General In the Object/library modules textbox add: glut32.lib as the first entry with a space separating it from the next entry. Then click OK Select FILE NEW from the main menu bar Select C++ Source File
7 Sample code What is the output? #include <GL/glut.h> // (or others, depending on the system in use) void init (void) { glclearcolor (1.0, 1.0, 1.0, 0.0); // Set display-window color to white. glmatrixmode (GL_PROJECTION); // Set projection parameters. gluortho2d (0.0, 200.0, 0.0, 150.0); } void linesegment (void) { glclear (GL_COLOR_BUFFER_BIT); // Clear display window. glcolor3f (0.0, 0.0, 1.0); // Set line segment color to blue. glbegin (GL_LINES); glvertex2i (180, 15); // Specify line-segment geometry. glvertex2i (10, 145); glend ( ); glflush ( ); // Process all OpenGL routines as quickly as possible. } void main (int argc, char** argv) { glutinit (&argc, argv); // Initialize GLUT. glutinitdisplaymode (GLUT_SINGLE GLUT_RGB); // Set display mode. glutinitwindowposition (50, 100); // Set top-left display-window position. glutinitwindowsize (400, 300); // Set display-window width and height. glutcreatewindow ("An Example OpenGL Program"); // Create display window. init ( ); // Execute initialization procedure. glutdisplayfunc (linesegment); // Send graphics to display window. glutmainloop ( ); // Display everything and wait. }
8 Syntax Header Files: Describes all function calls # include <GL/gl.h> (the core Library) # include <GL/glu.h> (the utility Library) # include <GL/glut.h> ( win. Toolkit Lib) Libraries You can call other libraries. Data Types variables for your program. float GLfloat int GLint
9 Syntax Function names glxxxyy() XXX - root command YY arguments type: a number and a data type For example: glcolor3f - used to specify a color with 3 float values glvertex2d - used to specify a vertex with 2 double values
10 glvertex To send vertices to the GL, call glvertex() glvertex3f( float x, float y, float z ); The number will represent how many dimensions you are drawing in, so you will use 2 or 3 The type of data you send is simply the format. You can send floats, (f), doubles (d), ints (i), shorts (s)
11 General Program structure void display(){ } void main(){ }
12 main function structure void main( ) { glutinitwindowsize(int width, int height); glutinitwindowposition(int x, int y); glutcreatewindow("opengl First Example"); glutdisplayfunc(display); glutmainloop(); }
13 glutinitwindowsize (int width, int height) width, height - the size of the window in pixels glutinitwindowposition (int x, int y) defines the position of the window on the screen X,Y - the top left corner. (0, 0) is the upper left corner of the display.
14 glutcreatewindow( Window Name ) Creates a window with the specified title. Note: the window is NOT displayed until glutmainloop() is called. Example: glutcreatewindow( Sphere");
15 Callback function glutdisplayfunc(displayfunc_name) The argument is a pointer to a callback function that takes no argument. Whenever the window needs refreshing this displayfunc is called. Therefore, you should put all the routines you need to redraw the scene in this function. Example: glutdisplayfunc(display);
16 glutmainloop( ) is the starting point of GLUT, windows are displayed and the event processing is started. glutdisplayfunc and glutmainloop are used to display a scene.
17 #include <GL/glut.h> void draw(void) { glclear(gl_color_buffer_bit); glbegin(gl_triangles); glcolor3f(1, 0, 0); glvertex2i(25, 25); glvertex2i(375, 25); glvertex2i(200, 375); glend(); glflush(); } void main(){ glutinitwindowsize(400,400); glutinitdisplaymode(glut_rgb); glutcreatewindow("opengl Set Up Test"); glutdisplayfunc(draw); glclearcolor(0.0, 0.0, 0.0, 0.0); gluortho2d(0.0, 400.0, 0.0, 400.0); glutmainloop(); } Sample Program
18 Graphics primitives
19 Points and Lines GL_POINTS GL_LINES Line segments GL_LINE_STRIP A series of one or more connected line segments the first vertex specifies the first segment s start point while the second vertex specifies the first segment s endpoint and the second segment s start point. GL_LINE_LOOP Same as GL_LINE_STRIP, in addition to connecting the last vertex with the first one.
20 What is the output? glbegin( GL_POINTS ); glvertex2i(25, 25); glvertex2i(375, 25); glvertex2i(200, 375); glvertex2i(375, 375); glend(); glbegin( GL_LINES ); glvertex2i(25, 25); glvertex2i(375, 25); glvertex2i(200, 375); glvertex2i(375, 375); glend(); glbegin( GL_LINE_STRIP ); glvertex2i(25, 25); glvertex2i(375, 25); glvertex2i(200, 375); glvertex2i(375, 375); glend(); glbegin( GL_LINE_LOOP ); glvertex2i(25, 25); glvertex2i(375, 25); glvertex2i(200, 375); glvertex2i(375, 375); glend();
21 Graphics primitives Cont. GL_POLYGON GL_TRIANGLES GL_TRIANGLE_STRIP GL_TRIANGLE_FAN GL_QUADS GL_QUAD_STRIP
22 GL_POLYGON To display a single polygon fill area At least 3 vertices Example: glbegin(gl_polygon); glvertex2i(25, 200); glvertex2i(125, 25); glvertex2i(275, 25); glvertex2i(375, 200); glvertex2i(275, 375); glvertex2i(125, 375); glend(); p6 p5 (125, 375) (275, 375) p1 p4 (25, 200) (375, 200) p2 p3 (125, 25) (275, 25)
23 GL_TRIANGLES To display Triangles Example: glbegin(gl_triangles); glvertex2i(25, 200); glvertex2i(125, 25); glvertex2i(275, 25); glvertex2i(375, 200); glvertex2i(275, 375); glvertex2i(125, 375); glend(); Output?
24 GL_TRIANGLE_STRIP A triangle strip is a series of triangles connected along shared edges. In this case, the first three vertices define the first triangle. Each subsequent vertex defines a new triangle using that point along with two vertices from the previous triangle. What is the necessary code to output the following shape using GL_TRIANGLE_STRIP? How many triangles do you need? (125, 375) p6 p5 (275, 375) p1 (25, 200) p4 (375, 200) p2 p3 (125, 25) (275, 25)
25 GL_TRIANGLE_FAN A triangle fan is the same as a triangle strip with one exception: each vertex after the first triangle always replaces the 2 nd vertex of the previous triangle. All triangles share a common vertex. What is the necessary code to output the following shape using GL_TRIANGLE_FAN? (125, 375) p6 p5 (275, 375) p1 (25, 200) p4 (375, 200) p2 p3 (125, 25) (275, 25)
26 GL_QUADS To display four-sided polygons At least four vertices Example glbegin(gl_quads); glvertex2i(25, 200); glvertex2i(125, 25); glvertex2i(275, 25); glvertex2i(375, 200); glvertex2i(275, 375); glvertex2i(125, 375); glend(); GL_QUAD_STRIP To display set of connected quads For n vertices (n>=4), we obtain n/2 1 quads
27 2D Viewing Viewport glviewport(xvmin, yvmin, vpwidth, vpheight); Clipping gluortho2d(xwmin, xwmax, ywmin, ywmax); Or glortho
28 Attributes: color, width and size Color: glcolor3f(r, G, B); Point size: glpointsize(size); Line width: gllinewidth(width);
29 Geometric Transformations For 2D transformations, we set t z =0, (v x, v y, v z )=(0,0,1), and s z =1 Suffix: f (float), d (double) Translation gltranslate(t x, t y, t z ); specifies a translation vector Example: gltranslatef(10.0, 20.0, 0.0); Rotation glrotate(theta, v x, v y, v z ); specifies a rotation angle about a rotation axis vector (v x, v y, v z ), with the axis passing through the origin. Example glrotatef(90.0, 0.0, 0.0, 1.0);
30 Geometric Transformations Scaling glscale(s x, s y, s z ); specifies multiplicative factors relative to the origin. Example glscalef(2.0, 1.0, 1.0); Reflection operation can be generated by setting scaling factors to negative Example glscalef(-1.0, 1.0, 1.0);
31 GLUT menus OpenGL supports menus so that the user can select multiple options. To use a menu in your program, you have to do: Define the entries in the menu. Link the menu to a particular mouse button. Define the callback function corresponding to each menu.
32 Menus To create a pop-up menu glutcreatemenu(menufcn); Where menufcn is the name of the procedure to be invoked when a menu entry is selected, This procedure has one argument, which is the integer value corresponding to the position of a selected menu void menufcn (GLint menuitemnumber);
33 Menus To add a menu entry, use glutaddmenuentry(charstring, menuitemnumber); charstring is the text to be displayed in the menu entry, and menuitemnumber gives the location of that entry, the following statements create a menu with two options: glutcreatemenu(menufcn); glutaddmenuentry( New, 1); glutaddmenuentry( Open, 2); We must specify a mouse button to be used to select a menu option: glutattachmenu(button);
34 Submenus submenuid = glutcreatemenu(submenufcn); glutaddmenuentry( First submenu item, 1);... glutcreatemenu(menufcn); glutaddmenuentry( First menu item, 1);... glutaddsubmenu( Submenu option, submenuid);
35 Example Let us define the following pop-up menu:
36 Example Define Right Button Menu glutcreatemenu(right_menu); glutaddmenuentry( Quit, 1); glutaddmenuentry( Clear, 2); glutattachmenu(glut_right_button); Define Color Menu C_menu = glutcreatemenu(color_menu); glutaddmenuentry( RED, 1); glutaddmenuentry( BLUE, 2); glutaddmenuentry( BLACK, 3); glutaddmenuentry( GREEN, 4); glutaddmenuentry( WHITE, 5);
37 Example Define Pixel Size Menu P_menu = glutcreatemenu(pixel_menu); glutaddmenuentry( Increase Size, 1); glutaddmenuentry( Decrease Size, 2); Define Left Menu glutcreatemenu(left_menu); glutaddsubmenu( COLOR, C_menu); glutaddsubmenu ( PIXEL SIZE, P_menu); glutattachmenu(glut_left_button);
38 Example Define all functions to a menu response: void Color_menu (GLint id) { if (id==1) glcolor3f(1.0,0.0,0.0); if (id==2) glcolor3f(0.0,0.0,1.0); if (id==3) glcolor3f(0.0,0.0,0.0); if (id==4) glcolor3f(0.0,1.0,0.0); if (id==5) glcolor3f(1.0,1.0,1.0); }
39 OpenGL Interactive Input-Device Functions GLUT Mouse Functions When a mouse button is pressed or released. glutmousefunc(mousefcn); void mousefcn(glint button, GLint action, GLint xmouse, GLint ymouse) button: GLUT_LEFT_BUTTON GLUT_MIDDLE_BUTTON GLUT_RIGHT_BUTTON action: GLUT_DOWN GLUT_UP //press //release (xmouse, ymouse): The coordinate position, This location is relative to the top-left corner of the display window
40 Mouse Functions When a mouse is moved within the display window with one or more buttons activated. glutmotionfunc(mousefcn); void mousefcn(glint xmouse,glint ymouse) When a mouse is moved within the display window without pressing a button. glutpassivemotionfunc(mousefcn);
41 GLUT Keyboard Functions When a key is pressed glutkeyboardfunc(keyfcn); void keyfcn(glubyte key, Glint xmouse, Glint ymouse) key is assigned a character value or the corresponding ASCII code.
42 Keyboard Functions For function keys and other special-purpose keys. glutspecialfunc(keyfcn); void keyfcn(glint specialkey, Glint xmouse, Glint ymouse) specialkey: GLUT_KEY_F1... GLUT_KEY_F12 GLUT_KEY_UP... GLUT_KEY_RIGHT GLUT_KEY_PAGE_DOWN GLUT_KEY_HOME Backspace, delete, and escape keys can be designated with glutkeyboardfunc using their ASCII code 8, 127 and 27 respectively.
43 OpenGL Codes Find the output of the attached C++ programs
Teacher Assistant : Tamir Grossinger Reception hours: by - Building 37 / office -102 Assignments: 4 programing using
Teacher Assistant : Tamir Grossinger email: tamirgr@gmail.com Reception hours: by email - Building 37 / office -102 Assignments: 4 programing using C++ 1 theoretical You can find everything you need in
More 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 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 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 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 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. 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 informationCS 548: COMPUTER GRAPHICS GLUT INPUT FUNCTIONS SPRING 2015 DR. MICHAEL J. REALE
CS 548: COMPUTER GRAPHICS GLUT INPUT FUNCTIONS SPRING 2015 DR. MICHAEL J. REALE INTRODUCTION Apart from creating the window, GLUT also allows accessing the mouse and keyboard as well as creating popup
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 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 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 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 informationLecture 11: Callbacks. CITS 3003 Graphics & Animation
Lecture 11: Callbacks CITS 3003 Graphics & Animation Slides: E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Learn to build interactive programs using GLUT callbacks
More 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 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 informationComputer Graphics (CS 543) Lecture 2b: 2D Graphics Systems (Drawing Polylines, tiling, & Aspect Ratio)
Computer Graphics (CS 543) Lecture 2b: 2D Graphics Systems (Drawing Polylines, tiling, & Aspect Ratio) Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Announcements All code
More informationGraphics Hardware and OpenGL
Graphics Hardware and OpenGL Ubi Soft, Prince of Persia: The Sands of Time What does graphics hardware have to do fast? Camera Views Different views of an object in the world 1 Camera Views Lines from
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 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 (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 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 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 informationThis library uses only GL functions but contains code for creating common objects and simplifying viewing.
PES Institute of Technology, Bangalore South Campus (Formerly PES School of Engineering) (Hosur Road, 1KM before Electronic City, Bangalore-560 100) INTERNAL TEST (SCHEME AND SOLUTION) 1 Subject Name:
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 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. 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 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 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 informationAnnouncement. Homework 1 has been posted in dropbox and course website. Due: 1:15 pm, Monday, September 12
Announcement Homework 1 has been posted in dropbox and course website Due: 1:15 pm, Monday, September 12 Today s Agenda Primitives Programming with OpenGL OpenGL Primitives Polylines GL_POINTS GL_LINES
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 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 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 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 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 informationCMSC 425: Lecture 4 More about OpenGL and GLUT Tuesday, Feb 5, 2013
CMSC 425: Lecture 4 More about OpenGL and GLUT Tuesday, Feb 5, 2013 Reading: See any standard reference on OpenGL or GLUT. Basic Drawing: In the previous lecture, we showed how to create a window in GLUT,
More informationProgramming with OpenGL Part 3: Three Dimensions
Programming with OpenGL Part 3: Three Dimensions Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Objectives Develop a more sophisticated
More informationComputer Graphics. Chapter 3 Computer Graphics Software
Computer Graphics Chapter 3 Computer Graphics Software Outline Graphics Software Packages Introduction to OpenGL Example Program 2 3 Graphics Software Software packages General Programming Graphics Packages
More informationIntroduction to MS Visual C/C++
3/4/2002 Burkhard Wünsche Introduction to C/C++ Page 1 of 9 0. Introduction: Introduction to MS Visual C/C++ This tutorial gives a simple introduction to MS Visual C/C++ with an emphasis on OpenGL graphics
More informationIntroduction to OpenGL: Part 2
Introduction to OpenGL: Part 2 Introduction to OpenGL: Part 2 A more complex example recursive refinement Introduction to OpenGL: Part 2 A more complex example recursive refinement Can OpenGL draw continuous
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 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 informationLECTURE 02 OPENGL API
COMPUTER GRAPHICS LECTURE 02 OPENGL API Still from Pixar s Inside Out, 2015 IMRAN IHSAN ASSISTANT PROFESSOR WWW.IMRANIHSAN.COM EARLY HISTORY OF APIS IFIPS (1973) formed two committees to come up with a
More informationComp 410/510 Computer Graphics Spring Input & Interaction
Comp 410/510 Computer Graphics Spring 2018 Input & Interaction Objectives Introduce the basic input devices - Physical Devices - Logical Devices Event-driven input Input Modes Programming event input with
More informationVTU EDUSAT PROGRAMME. Computer Graphics & Visualization
VTU EDUSAT PROGRAMME Computer Graphics & Visualization Interactions in Open GL using GLUT And Graphics Pipeline Sandeep Senan Interactions in Open GL using GLUT Ivan Sutherland (MIT 1963) established the
More 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 informationGraphics Programming. 1. The Sierpinski Gasket. Chapter 2. Introduction:
Graphics Programming Chapter 2 Introduction: - Our approach is programming oriented. - Therefore, we are going to introduce you to a simple but informative problem: the Sierpinski Gasket - The functionality
More informationComputer Graphics Introduction to OpenGL
! Computer Graphics 2014! 3. Introduction to OpenGL Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2014-09-29! ! 2. 2D Graphics Algorithms (cont.) Rasterization Scan converting lines
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 informationWorking with Callbacks
Working with Callbacks 1 Objectives Learn to build interactive programs using GLUT callbacks Mouse Keyboard Reshape Introduce menus in GLUT 2 The mouse callback glutmousefunc(mymouse) void mymouse(glint
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 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 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 information