COMP 371/4 Computer Graphics Week 1

Size: px
Start display at page:

Download "COMP 371/4 Computer Graphics Week 1"

Transcription

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 Prof. Gross, ETH

2 Instructor : Tiberiu Popa Office: EV Lectures: Thu 17:45 20:15 Office Hours: Fri 15:30-16:30 tiberiu.popa@concordia.ca Phone: (514) ext COMP 371 Week 1 2

3 Textbook Computer Graphics with OpenGL Donald Hearn and M. Pauline Baker Publisher: Prentice Hall Third Edition ISBN: Student Source Code 3 COMP 371 Week 1

4 Administration Course web page: moodle Course Mark Break-down: Assignments (3) 30% Midterm 20% Discussions 10% Final project 40% COMP 371 Week 1 4

5 Important Dates Homework (3, 10% each): HWK 1: Jan 23, 2014 HWK 2: Feb 13, 2014 HWK 3: March 19, 2014 Preliminary midterm date (20%): Feb 27, 2014 (in class) Project: To be discussed later COMP 371 Week 1 5

6 What is COMP371? COMP371 is a Computer Graphics course What is Computer Graphics? Everything on computer that is not text or sound 6 COMP 371 Week 1

7 What is COMP371? 7 COMP 371 Week 1

8 What is COMP371? 8 COMP 371 Week 1

9 What is COMP371? 9 COMP 371 Week 1

10 What is COMP371? 10 COMP 371 Week 1

11 What is COMP371? 11 COMP 371 Week 1

12 What is COMP371? 12 COMP 371 Week 1

13 What is COMP371? 13 COMP 371 Week 1

14 What is COMP371? 14 COMP 371 Week 1

15 What is COMP371? 15 COMP 371 Week 1

16 What is COMP371? 16 COMP 371 Week 1

17 What is COMP371? 17 COMP 371 Week 1

18 Impressive? Welcome to the fascinating world of computer graphics This course: first few steps Many courses to follow: COMP 376 Game design 1 COMP 476 Game design 2 COMP Animation COMP 691F - Geometry COMP 371 Week 1 18

19 What is 3D Graphics? Ingredients: Geometry (==Math) Shading (==light transport == physics) Recipes: Real-time: Heavily parallel graphics pipeline OpenGL Off-line: Ray-tracing, Path-tracing Radiosity COMP 371 Week 1 19

20 What is COMP371? You will learn The fundamental concepts of 3D Computer Graphics The basic algorithms used in Graphics The mechanics of writing programs in OpenGL How to solve complex problems using OpenGL You do need previous programming, in particular C/C++, to take this course VERY HIGH LOAD 20 COMP 371 Week 1

21 What Can We Do by the End of the Course? Write C/C++ and OpenGL applications such as: Program computer games and graphical applications You will be ready to take on part-time or full-time programming jobs COMP 371 Week 1 21

22 What you wil have to do Work VERY, VERY, VERY, VERY,, VERY hard This is one of the most difficult courses!!!!! Why? This is the foundation for those of you who want to specialize in graphics!!! Computer Graphics is beautiful (literally) but hard Start every assignment early Don t fall behind Ask if you don t know (in class; in the labs) Do your own work WATCH YOUR COURSE LOAD!!! Do not take other hard courses in parallel!!!! COMP 371 Week 1 22

23 Let s work backwards Example How was this image generated? 1. First is geometry 1. Representation 2. Modeling or acquisition 2. Place a virtual camera into the scene? 1. Transformations 3. Compute colors 1. Light-transport 2. Light equation 4. Convert it into pixels 1. COMP Scan 371 Week 1 conversion 23

24 Graphics Pipeline SGI (Silicon Graphics) improved the graphics workstation by implementing the pipeline in hardware (1982) Programmers used a library called GL. With GL, it was relatively simple to program three dimensional interactive applications COMP 371 Week 1 24

25 Computer Graphics: OpenGL API (1992) Completely computer-generated feature-length movies (Toy Story) are successful New hardware capabilities Texture mapping Blending Accumulation, stencil buffer Computer Graphics: Photorealism Graphics cards for PCs dominate market Nvidia, ATI, 3DLabs Game boxes and game players determine direction of market Computer graphics routine in movie industry: Maya, Lightwave COMP 371 Week 1 25

26 Outline of course Geometry Shading Texture mapping Modeling Animation Global illumination COMP 371 Week 1 26

27 Geometry Shading Texture mapping Modeling Animation Global illumination Outline of course How to specify the 3-D positions of the camera and the scene objects and their various parts, how to project these to 2-D image locations, and how to represent transformations of these positions COMP 371 Week 1 27

28 Outline of course Geometry Shading Texture mapping Modeling Animation Global illumination How to model light interaction with 3-D surfaces with varying material properties in order to calculate the proper colors perceived by the eye at different image locations COMP 371 Week 1 28

29 Outline of course Geometry Shading Texture mapping Modeling Animation Global illumination How to apply layers of detail to scene objects to show features, simulate bumps and reflections, or other precomputed shading effects. Procedural texturing is concerned with how some kinds of textures are generated algorithmically COMP 371 Week 1 29

30 Outline of course Geometry Shading Texture mapping Modeling Animation Global illumination How to efficiently represent the geometry of scene objects, which may be complex, curved, etc. COMP 371 Week 1 30

31 Outline of course Geometry Shading Texture mapping Modeling Animation Global illumination How to render dynamic scenes COMP 371 Week 1 31

32 Outline of course Geometry Shading Texture mapping Modeling Animation Global illumination How to realistically simulate inter-reflections of light between multiple sources and object surfaces COMP 371 Week 1 32

33 What is Computer Graphics? Computer Graphics has following components: Modeling: Create and represent the geometry of objects in the 3D world Rendering: Generate 2D images of the objects Animation: Describe how objects move Models come from a diverse and expanding sets of fields, and include physical, mathematical, engineering, architectural, and even conceptual structures, natural phenomena, and so on. COMP 371 Week 1 33

34 Take the real and turn it into a virtual representation Explain the real world or fantastic objects using mathematics If the image does not exist in real life, a blueprint is drawn by an artist Modeling A wire frame is the simplest form of model 34 COMP 371 Week 1 Wireframe Model

35 Rendering Wireframe Model Draw the image on 2D screen Color Lighting Shading Surface texture Shadows Reflection and transparency Final Render

36 The Programmer s Interface Programmer sees the graphics system through the Application Programmer Interface (API) API contents: Functions that specify what we need to form an image Objects Viewer Light Source(s) Materials Other information Input from devices such as mouse and COMP 371 Week 1 36 keyboard

37 Computer Graphics: representing the world as pixels Scenes Are Made of Objects: 1. Thousands of objects per scene 2. Millions of primitives make up a scene 3. Speed is key Objects Are Made of Primitives: 1. More primitives mean a more realistic object 2. Thousands of primitives can make up each object: Primitives Are Made of Pixels: 1. Primitives are 2-D shapes (lines, triangles, 37 circles, etc.) COMP 371 Week 1

38 What is OpenGL? OpenGL is a programming interface mainly for 3D applications invented by Silicon Graphics. It renders 3D objects to the screen, providing the same set of instructions on different computers and graphics adapters. The OpenGL API was designed for use with the C and C++ programming languages, and allows developers in diverse markets such as broadcasting, CAD/CAM/CAE, entertainment, medical imaging, and virtual reality to produce and display incredibly compelling 2D and 3D graphics. Why using OpenGL: Industry standard Stable Reliable and portable Easy to use Well-documented COMP 371 Week 1 38

39 What OpenGL Does Allows definition of object shapes, material properties and lighting Arranges objects and interprets synthetic camera in 3D space Converts mathematical representations of objects into pixels (rasterisation) Calculates the colour of every object Provides no high-level rendering functions for complex objects; you must build your shapes from primitives (points, lines, polygons, etc.). The utility library GLU provides some support. COMP 371 Week 1 39

40 3 Stages in OpenGL Define Objects in World Scene Set Modeling and Viewing Transformations Render the Scene

41 How OpenGL Works OpenGL is a state machine You give it orders to set the current state of any one of its internal variables, or to query for its current status The current state won t change until you specify otherwise Ex.: if you set the current color to Red, everything you draw will be painted Red until you change the color explicitly Each of the system s state variables has a default value COMP 371 Week 1 41

42 GLUT (OpenGL Utility Toolkit) GLUT is a window-system-independent toolkit; it provides tools to assist with event and windows management. GLUT supports Multiple windows for OpenGL rendering. Callback driven event processing. Sophisticated input devices. An idle routine and timers. A simple, cascading pop-up menu facility. Utility routines to generate various solid and wire frame objects. Support for bitmap and stroke fonts. Miscellaneous window management functions, including managing overlays. COMP 371 Week 1 42

43 Structure of GLUT-Assisted Programs GLUT relies on user-defined callback functions, which it calls whenever some event occurs Function to display the screen Function to resize the viewport Functions to handle keyboard and mouse events COMP 371 Week 1 43

44 The 3D Graphics Pipeline Modelling Transformation Trivial Rejections Illumination Viewing Transformation Clipping Projection Rasterisation Display Almost every course on 3D graphics begins like this one. Primitives are processed in a series of steps. Each step forwards its result onto the next step. It is a useful abstraction of projective rendering, as well as a block diagram for dedicated graphics hardware. COMP 371 Week 1 44

45 The OpenGL Rendering Pipeline First step: Modelling transformations We start with 3D objects defined in their own coordinate system called model space We apply transformations to move and orient the objects according to a common coordinate system called world space All objects, light sources and cameras live in world space COMP 371 Week 1 45

46 Transformations Transformations are functions that map points from one place to another: COMP 371 Week 1 46

47

48 Transformations Almost every step in the rendering pipeline involves a change of coordinate systems. Transformations are central to understanding 3D computer graphics. The best way to implement transformations is with matrix operations. In the later classes we will discuss 2D matrices and transformations and then generalize to 3D matrices and transformations. Projections can also be expressed using matrices. COMP 371 Week 1 48

49 The OpenGL Rendering Pipeline Second Step: Trivial Rejections OpenGL attempts to remove all objects that can t possibly be seen from the list of items to process. This is an optimization, and not all implementations do it the same way COMP 371 Week 1 49

50 The OpenGL Rendering Pipeline Third Step: Illumination Light sources influence the way objects are drawn The lighting model (Phong illumination in OpenGL) influences the colors of all vertices The shading model (Gouraud shading in OpenGL) influences how colors are interpolated across faces Illumination also determines shadows COMP 371 Week 1 50

51 The OpenGL Rendering Pipeline Fourth Step: Viewing Transformation We transform again, from world space to eye space (or view) coordinates The camera is now located at the origin, and the viewing direction is aligned with some axis COMP 371 Week 1 51

52

53 The OpenGL Rendering Pipeline Fifth Step: Clipping and Projection A viewing volume is defined: objects located outside of this field of view are culled from the rendering. Next, the remaining objects are projected into two dimensions, which transforms their coordinates into screen space COMP 371 Week 1 53

54

55 The OpenGL Rendering Pipeline Final Step: Rasterization and Display Convert objects into pixels and display only those that are in front of any other objects Place pixels in the appropriate locations in the application window COMP 371 Week 1 55

56 Scan Conversion From this P = P0 + D.t an ideal geometric primitive A bag of pixels of different colours COMP 371 Week 1 56

57 Projective Rendering (OpenGL) Start with objects defined using polygons / primitives. Frame Buffer World objects In 2-D, map objects onto the screen In 3-D, project them onto the screen. This is called forward mapping. COMP 371 Week 1 57

58 Viewport Transformation Maps the 2D world in screen units into pixels in the display window. Y Viewport Transformation Viewport Units x COMP 371 Week 1 58

59 OpenGL Evolution Controlled by an Architectural Review Board (ARB) Members include SGI, Microsoft, Nvidia, HP, 3DLabs, IBM,. Relatively stable (present version 2.0; 3.2 recently released) Evolution reflects new hardware capabilities 3D texture mapping and texture objects Vertex programs Allows for platform specific features through extensions OpenGL Libraries GL (Graphics Library): Library of 2-D, 3-D drawing primitives and operations API for 3-D hardware acceleration GLU (GL Utilities): Miscellaneous functions dealing with camera setup and higher-level shape descriptions GLUT (GL Utility Toolkit): Window-system independent toolkit with numerous utility functions, mostly dealing with user interface COMP 371 Week 2 59

60 OpenGL Basics Rendering Converting geometric/mathematical objects descriptions into frame buffer values OpenGL can render: Geometric primitives Bitmaps and Images (Raster primitives) Graphics Pipeline COMP 371 Week 2 60

61 OpenGL as a Renderer 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. Header Files #include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h> #include <glui.h> COMP 371 Week 2 61

62 GLUI GLUI is a GLUT-based C++ user interface library which provides controls such as buttons, checkboxes, radio buttons, spinners, etc. It is window-system independent, relying on GLUT to handle all system-dependent issues, such as window and mouse management. COMP 371 Week 2 62

63 Sample Program #include <GL/glut.h> #include <GL/gl.h> void main(int argc, char** argv) { } int mode = GLUT_RGB GLUT_DOUBLE; glutinitdisplaymode( mode ); glutinitwindowsize( 500,500 ); glutcreatewindow( Simple ); init(); glutdisplayfunc( display ); glutkeyboardfunc( key ); glutmainloop(); COMP 371 Week 2 63

64 Sample Program #include <GL/glut.h> #include <GL/gl.h> void main(int argc, char** argv) { } int mode = GLUT_RGB GLUT_DOUBLE; glutinitdisplaymode( mode ); glutinitwindowsize( 500,500 ); glutcreatewindow( Simple ); init(); glutdisplayfunc( display ); glutkeyboardfunc( key ); glutmainloop(); Specify the display Mode RGB or color Index; single or double Buffer COMP 371 Week 2 64

65 Sample Program #include <GL/glut.h> #include <GL/gl.h> void main(int argc, char** argv) { } int mode = GLUT_RGB GLUT_DOUBLE; glutinitdisplaymode( mode ); glutinitwindowsize( 500,500 ); glutcreatewindow( Simple ); init(); glutdisplayfunc( display ); glutkeyboardfunc( key ); glutmainloop(); Create a window Named simple with resolution 500 x 500 COMP 371 Week 2 65

66 Sample Program #include <GL/glut.h> #include <GL/gl.h> void main(int argc, char** argv) { } int mode = GLUT_RGB GLUT_DOUBLE; glutinitdisplaymode( mode ); glutinitwindowsize( 500,500 ); glutcreatewindow( Simple ); init(); glutdisplayfunc( display ); glutkeyboardfunc( key ); glutmainloop(); Your OpenGL initialization code (Optional) COMP 371 Week 2 66

67 Sample Program #include <GL/glut.h> #include <GL/gl.h> void main(int argc, char** argv) { } int mode = GLUT_RGB GLUT_DOUBLE; glutinitdisplaymode( mode ); glutinitwindowsize( 500,500 ); glutcreatewindow( Simple ); init(); glutdisplayfunc( display ); glutkeyboardfunc( key ); glutmainloop(); Register your call back functions COMP 371 Week 2 67

68 Sample Program #include <GL/glut.h> #include <GL/gl.h> void main(int argc, char** argv) { } int mode = GLUT_RGB GLUT_DOUBLE; glutinitdisplaymode( mode ); glutinitwindowsize( 500,500 ); glutcreatewindow( Simple ); init(); glutdisplayfunc( display ); glutkeyboardfunc( key ); glutmainloop(); The program goes into an infinite loop waiting for events COMP 371 Week 2 68

69 OpenGL Initialization Set up whatever state you re going to use void init( void ) { glviewport(0, 0, width, height); glmatrixmode(gl_projection); glloadidentity(); glortho(-10, 10, -10, 10, -10, 20); glmatrixmode(gl_modelview); glloadidentity(); // glenable( GL_LIGHT0 ); // glenable( GL_LIGHTING ); } // glenable( GL_DEPTH_TEST ); COMP 371 Week 2 69

70 GLUT Callback functions Event-driven: Programs that use windows Input/Output Wait until an event happens and then execute some pre-defined functions according to the user s input Events key press, mouse button press and release, window resize, etc. Callback function : Routine to call when an event happens Window resize or redraw User input (mouse, keyboard) Animation (render many frames) Register callbacks with GLUT glutdisplayfunc( my_display ); glutidlefunc( my_idle_func ); glutkeyboardfunc( my_key_events ); glutmousefunc ( my_mouse ); COMP 371 Week 2 70

71 What to Know to Start We will use C/C++ syntax OpenGL initialization won t be presented platform dependent Everything should be portable Tutorials: Official OpenGL site: OpenGL - Libraries 3 basic libraries: OpenGL: main functions GLU: premade objects, helper functions GLaux: loading textures GLUT and others COMP 371 Week 2 71

72 Graphics Definitions Point a location in space, 2D or 3D sometimes denotes one pixel Line straight path connecting two points infinitesimal width, consistent density beginning and end on points COMP 371 Week 2 Vertex point in 2D or 3D Edge line in 3D connecting two vertices Polygon/Face/Facet arbitrary shape formed by connected vertices fundamental unit of 3D computer graphics 72

73 OpenGL Command Syntax All command names begin with gl Ex.: glvertex3f( 0.0, 1.0, 1.0 ); Constant names are in all uppercase Ex.: GL_COLOR_BUFFER_BIT Data types begin with GL Ex.: GLfloat onevertex[ 3 ]; Most commands end in two characters that determine the data type of expected arguments Ex.: glvertex3f( ) => 3 GLfloat arguments COMP 371 Week 2 73

74 OpenGL Command Formats glvertex3fv( v ) Number of components 2 - (x,y) 3 - (x,y,z), (r,g,b) 4 - (x,y,z,w), (r,g,b,a) 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 e.g., glvertex2f(x, y) glcolor3f(r, g, b) COMP 371 Week 2 74

75 Specifying Object Vertices Every object is specified by vertices: glvertex3f(2.0,4.1,6.0); // specifies a vertex at the // x, y, z coordinate (2.0, 4.1, 6.0). // The 3f means 3 floating point coordinates. Other examples: glvertex2i(4, 5); // 2 integers for x and y. z = 0. float vector[3] = {5.0, 3.2, 5.0}; glvertex3fv(vector); // using vector positions COMP 371 Week 2 75

76 Object Specification Most APIs support a limited set of primitives including Points (1D object) Line segments (2D objects) Polygons (3D objects) Some curves and surfaces Quadrics Parametric polynomial All are defined through locations in space or vertices type of object location of vertex glbegin(gl_polygon) glvertex3f(0.0, 0.0, 0.0); glvertex3f(0.0, 1.0, 0.0); glvertex3f(0.0, 0.0, 1.0); glend( ); 76 end of object definition COMP 371 Week 2

77 Polygon Types Polygons (GL_POLYGON) successive vertices define line segments, last vertex connects to first Triangles and Quadrilaterals (GL_TRIANGLES, GL_QUADS) successive groups of 3 or 4 interpreted as triangles or quads Strips and Fans (GL_TRIANGLE_STRIP, GL_QUAD_STRIP, GL_TRIANGLE_FAN) joined triangles or quads that share vertices COMP 371 Week 2 77

78 Primitives: OpenGL Primitives (including some line primitives) GL_POINTS GL_LINES GL_LINE_STRIP GL_POLYGON GL_LINE_LOOP GL_TRIANGLES GL_QUAD_STRIP GL_TRIANGLE_STRIP GL_TRIANGLE_FAN COMP 371 Week 2 78

79 simple.cpp #include <GL/glut.h> void mydisplay(){ glclear(gl_color_buffer_bit); glbegin(gl_polygon); glvertex2f(-0.5, -0.5); glvertex2f(-0.5, 0.5); glvertex2f(0.5, 0.5); glvertex2f(0.5, -0.5); glend(); glflush(); } int main(int argc, char** argv){ glutcreatewindow("simple"); glutdisplayfunc(mydisplay); glutmainloop(); } Event Loop Note that the program defines a display callback function named mydisplay Every GLUT program must have a display callback The display callback is executed whenever OpenGL decides the display must be refreshed, for example when the window is opened The main function ends with the program entering an event loop COMP 371 Week 2 79

80 Drawing Vertices glbegin(gl_points); glvertex2s(2,3); // point (2, 3, 0) glvertex3d(0.0,0.0, ); glvertex4f(2.3,1.0,-2.2,2.0); // point (1.15, 0.5, -1.1) GLdouble dvect[3] = {5.0,9.0,1992.0}; glvertex3dv(dvect); glend(); glpointsize(glint s) changes the size of the vertex to s pixels. Default is one pixel. 80 COMP 371 Week 2

81 Other Commands in glbegin / glend blocks Not every OpenGL command can be located in such a block. Those that can be included, among others are: glcolor glnormal (to define a normal vector) gltexcoord (to define texture coordinates) glmaterial (to set material properties) COMP 371 Week 2 81

82 Color in OpenGL void glcolor3{b s i f d ub us ui} (TYPE r, TYPE g, TYPE b); Specify a color for drawing the object glcolor3f(1.0,0.0,0.0) this present a red color 3f = use a RGB model, and the value of the component is float in C. Current color affects any vertices created subsequently glcolor3f (0.0, 0.5, 1.0); // no Red, half-intensity Green, full-intensity Blue COMP6761 Week 8 82

83 Using RGB Color with OpenGL void glclearcolor(glclampf red, GLclampf green, GLclampf blue, GLclampf alpha); Specify a color for clearing the screen glclearcolor(0, 0, 0, 0); // black color glclear(gl_color_buffer_bit); // clear screen glcolor3f(1.0, 0.0, 0.0); // red color glbegin(gl_triangle); // drawing a triangle red color glvertex2f (5.0, 5.0); glvertex2f (25.0, 5.0); glvertex2f (5.0, 25.0); glend(); COMP6761 Week 8 83

84 Example glcolor3f( 0.0, 1.0, 0.0); glpointsize( 5.0 ); //5 pixels wide glbegin( GL_POINTS ); glvertex2f( 3, 3 ); glvertex2f( 4, 4 ); glvertex2f( 5, 5 ); glend(); glbegin( GL_POLYGON ); glcolor3f( 1.0, 1.0, 0.0 ); glvertex3f( 0.0, 0.0, 0.0 ); glcolor3f( 0.0, 1.0, 1.0 ); glvertex3f( 5.0, 0.0, 0.0 ); glcolor3f( 1.0, 0.0, 1.0 ); glvertex3f( 0.0, 5.0, 0.0 ); glend(); COMP 371 Week 2 84

85 Winding Order Polygons in OpenGL are usually one-sided, meaning they can only be viewed from their front side If you try to draw a polygon with its back side facing the viewer, the result is nothing! In order to draw the front side of a polygon, the vertices must be specified in counter-clockwise order glbegin(gl_polygon); glvertex2f(0.0, 0.0); glvertex2f(1.0, 0.0); glvertex2f(0.0, 1.0); glend(); (3) (1) (2) glbegin(gl_polygon); glvertex2f(0.0, 0.0); glvertex2f(0.0, 1.0); glvertex2f(1.0, 0.0); COMP 371 Week 2 glend(); (2) (1) (3) 85 nothing!

86 OpenGL 3D Shapes Complex objects made of triangles or other polygons Can be time consuming More than 1 polygon between glbegin() and glend(), glrotatef(-15.0f, 1.0f, 0.0f, 0.0f);// rotate -15 around y axis glrotatef(-35.0f, 0.0f, 1.0f, 0.0f);// rotate -35 around y axis glbegin(gl_triangles); glvertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Front) glvertex3f(-1.0f,-1.0f, 1.0f); // Left Of Triangle (Front) glvertex3f( 1.0f,-1.0f, 1.0f); // Right Of Triangle (Front) glvertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Right) glvertex3f( 1.0f,-1.0f, 1.0f); // Left Of Triangle (Right) glvertex3f( 1.0f,-1.0f,-1.0f); // Right Of Triangle (Right) glvertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Back) glvertex3f( 1.0f,-1.0f,-1.0f); // Left Of Triangle (Back) glvertex3f(-1.0f,-1.0f,-1.0f); // Right Of Triangle (Back) glvertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Left) glvertex3f(-1.0f,-1.0f,-1.0f); // Left Of Triangle (Left) glvertex3f(-1.0f,-1.0f, 1.0f); // Right Of Triangle (Left) glend(); COMP 371 // Week Done 2 Drawing The Pyramid 86

87 OpenGL 3D Shape Example void drawcube(glint size, GLfloat color[]) { static GLfloat v[8][3]; v[0][0] = v[3][0] = v[4][0] = v[7][0] = -size/2.0; v[1][0] = v[2][0] = v[5][0] = v[6][0] = size/2.0; v[0][1] = v[1][1] = v[4][1] = v[5][1] = -size/2.0; v[2][1] = v[3][1] = v[6][1] = v[7][1] = size/2.0; v[0][2] = v[1][2] = v[2][2] = v[3][2] = -size/2.0; v[4][2] = v[5][2] = v[6][2] = v[7][2] = size/2.0; glbegin(gl_polygon); glcolor3fv( color ); glvertex3fv( v[0] ); glvertex3fv( v[1] ); glvertex3fv( v[2] ); glvertex3fv( v[3] ); glend(); // etc for other faces V7 V4 V6 V5 } COMP 371 Week 2 87

88 GLUT/GLU 3D Object Functions GLUT provides functions to draw: Regular polyhedra: glutwirecube, glutsolidcube, and similar for Tetrahedron, Octahedron, Dodecahedron, and Icosahedron. Quadric surfaces: similar for Sphere, Cone, and Torus (e.g., glutsolidcone) Teapot GLU provides additional Quadric surface functions (see Section 8-6 of H&B for details). COMP 371 Week 2 88

RECITATION - 1. Ceng477 Fall

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

More information

Introduction to Computer Graphics with OpenGL/GLUT

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

More information

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

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

More information

Lecture 4 of 41. Lab 1a: OpenGL Basics

Lecture 4 of 41. Lab 1a: OpenGL Basics Lab 1a: OpenGL Basics William H. Hsu Department of Computing and Information Sciences, KSU KSOL course pages: http://snipurl.com/1y5gc Course web site: http://www.kddresearch.org/courses/cis636 Instructor

More information

Computer Graphics. Bing-Yu Chen National Taiwan University

Computer Graphics. Bing-Yu Chen National Taiwan University Computer Graphics Bing-Yu Chen National Taiwan University Introduction to OpenGL General OpenGL Introduction An Example OpenGL Program Drawing with OpenGL Transformations Animation and Depth Buffering

More information

Teacher Assistant : Tamir Grossinger Reception hours: by - Building 37 / office -102 Assignments: 4 programing using

Teacher Assistant : Tamir Grossinger   Reception hours: by  - Building 37 / office -102 Assignments: 4 programing using Teacher Assistant : Tamir Grossinger email: tamirgr@gmail.com Reception hours: by email - Building 37 / office -102 Assignments: 4 programing using C++ 1 theoretical You can find everything you need in

More information

Computer Graphics. OpenGL

Computer Graphics. OpenGL Computer Graphics OpenGL What is OpenGL? OpenGL (Open Graphics Library) is a library for computer graphics It consists of several procedures and functions that allow a programmer to specify the objects

More information

Programming using OpenGL: A first Introduction

Programming using OpenGL: A first Introduction Programming using OpenGL: A first Introduction CMPT 361 Introduction to Computer Graphics Torsten Möller Machiraju/Zhang/Möller 1 Today Overview GL, GLU, GLUT, and GLUI First example OpenGL functions and

More information

Programming with OpenGL Part 2: Complete Programs Computer Graphics I, Fall

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

Computer Graphics (Basic OpenGL)

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

OpenGL refresher. Advanced Computer Graphics 2012

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

More information

Lecture 2 2D transformations Introduction to OpenGL

Lecture 2 2D transformations Introduction to OpenGL Lecture 2 2D transformations Introduction to OpenGL OpenGL where it fits what it contains how you work with it OpenGL parts: GL = Graphics Library (core lib) GLU = GL Utilities (always present) GLX, AGL,

More information

Lecture 2 CISC440/640 Spring Department of Computer and Information Science

Lecture 2 CISC440/640 Spring Department of Computer and Information Science Lecture 2 CISC440/640 Spring 2015 Department of Computer and Information Science Today s Topic The secrets of Glut-tony 2 So let s do some graphics! For the next week or so this is your world: -1 1-1 1

More information

Graphics Programming

Graphics 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

Computer Graphics 1 Computer Graphics 1

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

More information

Lectures OpenGL Introduction

Lectures OpenGL Introduction Lectures OpenGL Introduction By Tom Duff Pixar Animation Studios Emeryville, California and George Ledin Jr Sonoma State University Rohnert Park, California 2004, Tom Duff and George Ledin Jr 1 What is

More information

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

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

More information

CS 4204 Computer Graphics

CS 4204 Computer Graphics CS 4204 Computer Graphics OpenGL Basics Yong Cao Virginia Tech References: 2001 Siggraph, An Interactive Introduction to OpenGL Programming, Dave Shreiner,Ed Angel, Vicki Shreiner Official Presentation

More information

GL_COLOR_BUFFER_BIT, GL_PROJECTION, GL_MODELVIEW

GL_COLOR_BUFFER_BIT, GL_PROJECTION, GL_MODELVIEW OpenGL Syntax Functions have prefix gl and initial capital letters for each word glclearcolor(), glenable(), glpushmatrix() glu for GLU functions glulookat(), gluperspective() constants begin with GL_,

More information

To Do. Computer Graphics (Fall 2008) Course Outline. Course Outline. Methodology for Lecture. Demo: Surreal (HW 3)

To Do. Computer Graphics (Fall 2008) Course Outline. Course Outline. Methodology for Lecture. Demo: Surreal (HW 3) Computer Graphics (Fall 2008) COMS 4160, Lecture 9: OpenGL 1 http://www.cs.columbia.edu/~cs4160 To Do Start thinking (now) about HW 3. Milestones are due soon. Course Course 3D Graphics Pipeline 3D Graphics

More information

Exercise 1 Introduction to OpenGL

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

More information

Computer Graphics. Making Pictures. Computer Graphics CSC470 1

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

Introduction to OpenGL Week 1

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

Objectives. Image Formation Revisited. Physical Approaches. The Programmer s Interface. Practical Approach. Introduction to OpenGL Week 1

Objectives. 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 information

Assignment 1. Simple Graphics program using OpenGL

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

CS Computer Graphics: OpenGL, Continued

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

More information

CS Computer Graphics: OpenGL, Continued

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

More information

Computer Graphics, Chapt 08

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

OpenGL. Jimmy Johansson Norrköping Visualization and Interaction Studio Linköping University

OpenGL. 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 information

Graphics Programming. August 31, Programming of the Sierpinski gasket. Programming with OpenGL and C/C++

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

CS559: Computer Graphics. Lecture 12: OpenGL Li Zhang Spring 2008

CS559: Computer Graphics. Lecture 12: OpenGL Li Zhang Spring 2008 CS559: Computer Graphics Lecture 12: OpenGL Li Zhang Spring 2008 Reading Redbook Ch 1 & 2 So far: 3D Geometry Pipeline Model Space (Object Space) Rotation Translation Resizing World Space M Rotation Translation

More information

CS 543 Lecture 1 (Part 3) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

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

COMPUTER GRAPHICS LAB # 3

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

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

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

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

More information

Precept 2 Aleksey Boyko February 18, 2011

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

Programming with OpenGL Part 1: Background

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

Rendering. Part 1 An introduction to OpenGL

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

More information

OpenGL/GLUT Intro. Week 1, Fri Jan 12

OpenGL/GLUT Intro. Week 1, Fri Jan 12 University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner OpenGL/GLUT Intro Week 1, Fri Jan 12 http://www.ugrad.cs.ubc.ca/~cs314/vjan2007 News Labs start next week Reminder:

More information

Basic Graphics Programming

Basic Graphics Programming 15-462 Computer Graphics I Lecture 2 Basic Graphics Programming Graphics Pipeline OpenGL API Primitives: Lines, Polygons Attributes: Color Example January 17, 2002 [Angel Ch. 2] Frank Pfenning Carnegie

More information

Drawing Primitives. OpenGL basics

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

Early History of APIs. PHIGS and X. SGI and GL. Programming with OpenGL Part 1: Background. Objectives

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

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

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

More information

Computer Graphics Course 2005

Computer Graphics Course 2005 Computer Graphics Course 2005 Introduction to GLUT, GLU and OpenGL Administrative Stuff Teaching Assistant: Rony Goldenthal Reception Hour: Wed. 18:00 19:00 Room 31 (Ross 1) Questions: E-mail: cg@cs Newsgroups:

More information

Computer Graphics Introduction to OpenGL

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

Programming with OpenGL Part 1: Background

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

Introduction to OpenGL. CSCI 4229/5229 Computer Graphics Fall 2012

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

CSC Graphics Programming. Budditha Hettige Department of Statistics and Computer Science

CSC Graphics Programming. Budditha Hettige Department of Statistics and Computer Science CSC 307 1.0 Graphics Programming Department of Statistics and Computer Science Graphics Programming 2 Common Uses for Computer Graphics Applications for real-time 3D graphics range from interactive games

More information

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

Graphics Pipeline & APIs

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

More information

Abel J. P. Gomes LAB. 1. INTRODUCTION TO OpenGL

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

GLUT. What is OpenGL? Introduction to OpenGL and GLUT

GLUT. 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 information

Basic Graphics Programming

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

More information

Programming of Graphics

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

Graphics Pipeline & APIs

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

More information

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

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

More information

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

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

More information

CIS 441/541: Introduction to Computer Graphics Lecture 14: OpenGL Basics

CIS 441/541: Introduction to Computer Graphics Lecture 14: OpenGL Basics CIS 441/541: Introduction to Computer Graphics Lecture 14: OpenGL Basics Oct. 26th, 2016 Hank Childs, University of Oregon Announcements OH Hank: Weds 1-2, Thursday 11-12 Dan: Weds 4-530, Thursday 930-11

More information

An Overview GLUT GLSL GLEW

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

More information

Computer graphics MN1

Computer graphics MN1 Computer graphics MN1 http://www.opengl.org Todays lecture What is OpenGL? How do I use it? Rendering pipeline Points, vertices, lines,, polygons Matrices and transformations Lighting and shading Code

More information

// double buffering and RGB glutinitdisplaymode(glut_double GLUT_RGBA); // your own initializations

// double buffering and RGB glutinitdisplaymode(glut_double GLUT_RGBA); // your own initializations #include int main(int argc, char** argv) { glutinit(&argc, argv); Typical OpenGL/GLUT Main Program // GLUT, GLU, and OpenGL defs // program arguments // initialize glut and gl // double buffering

More information

API for creating a display window and using keyboard/mouse interations. See RayWindow.cpp to see how these are used for Assignment3

API for creating a display window and using keyboard/mouse interations. See RayWindow.cpp to see how these are used for Assignment3 OpenGL Introduction Introduction OpenGL OpenGL is an API for computer graphics. Hardware-independent Windowing or getting input is not included in the API Low-level Only knows about triangles (kind of,

More information

Computer Graphics Primitive Attributes

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

Lecture 3 Advanced Computer Graphics (CS & SE )

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

More information

Introduction to OpenGL

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

2. OpenGL -I. 2.1 What is OpenGL? Things OpenGL can do: -23-

2. 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 information

Computer Graphics (CS 4731) OpenGL/GLUT(Part 1)

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

CSC 8470 Computer Graphics. What is Computer Graphics?

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

API Background. Prof. George Wolberg Dept. of Computer Science City College of New York

API Background. Prof. George Wolberg Dept. of Computer Science City College of New York API Background Prof. George Wolberg Dept. of Computer Science City College of New York Objectives Graphics API history OpenGL API OpenGL function format Immediate Mode vs Retained Mode Examples The Programmer

More information

Books, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D

Books, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D Books, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D CS334 Spring 2012 Daniel G. Aliaga Department of Computer Science Purdue University Computer Graphics Pipeline Geometric Primitives

More information

An Interactive Introduction to OpenGL Programming

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

C++ is Fun Part 13 at Turbine/Warner Bros.! Russell Hanson

C++ is Fun Part 13 at Turbine/Warner Bros.! Russell Hanson C++ is Fun Part 13 at Turbine/Warner Bros.! Russell Hanson Syllabus 1) First program and introduction to data types and control structures with applications for games learning how to use the programming

More information

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

CS Computer Graphics: Intro to OpenGL

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

More information

CS Computer Graphics: Intro to OpenGL

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

More information

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

3D computer graphics: geometric modeling of objects in the computer and rendering them

3D computer graphics: geometric modeling of objects in the computer and rendering them SE313: Computer Graphics and Visual Programming Computer Graphics Notes Gazihan Alankus, Spring 2012 Computer Graphics 3D computer graphics: geometric modeling of objects in the computer and rendering

More information

Graphics Programming. 1. The Sierpinski Gasket. Chapter 2. Introduction:

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

1.2 Basic Graphics Programming

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

More information

Computer graphic -- Programming with OpenGL I

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

LECTURE 02 OPENGL API

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

More information

OpenGL. Toolkits.

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

More information

Introduction to OpenGL

Introduction to OpenGL Introduction to OpenGL Banafsheh Azari http://www.uni-weimar.de/cms/medien/cg.html What You ll See Today What is OpenGL? Related Libraries OpenGL Command Syntax B. Azari http://www.uni-weimar.de/cms/medien/cg.html

More information

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

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

More information

OpenGL Introduction Computer Graphics and Visualization

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

Books, OpenGL, GLUT, CUDA, OpenCL, OpenCV, PointClouds, G3D, and Qt

Books, OpenGL, GLUT, CUDA, OpenCL, OpenCV, PointClouds, G3D, and Qt Books, OpenGL, GLUT, CUDA, OpenCL, OpenCV, PointClouds, G3D, and Qt CS334 Fall 2015 Daniel G. Aliaga Department of Computer Science Purdue University Books (and by now means complete ) Interactive Computer

More information

Cameras (and eye) Ideal Pinhole. Real Pinhole. Real + lens. Depth of field

Cameras (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 information

Announcements OpenGL. Computer Graphics. Autumn 2009 CS4815

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

Models and Architectures. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Models and Architectures. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015 Models and Architectures 1 Objectives Learn the basic design of a graphics system Introduce pipeline architecture Examine software components for an interactive graphics system 2 Image Formation Revisited

More information

Programming with OpenGL Part 3: Three Dimensions

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

Announcements OpenGL. Computer Graphics. Spring CS4815

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

OpenGL: A Practical Introduction. (thanks, Mark Livingston!)

OpenGL: A Practical Introduction. (thanks, Mark Livingston!) OpenGL: A Practical Introduction (thanks, Mark Livingston!) Outline What is OpenGL? Auxiliary libraries Basic code structure Rendering Practical hints Virtual world operations OpenGL Definitions Software

More information

Geometry Primitives. Computer Science Department University of Malta. Sandro Spina Computer Graphics and Simulation Group. CGSG Geometry Primitives

Geometry 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

CSE 167: Introduction to Computer Graphics Lecture #5: Visibility, OpenGL

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

CS559: Computer Graphics. Lecture 12: OpenGL Transformation Li Zhang Spring 2008

CS559: 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 information

Graphics Hardware and OpenGL

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

Lecture 3. Understanding of OPenGL programming

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

Graphics and Visualization

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

CS418 OpenGL & GLUT Programming Tutorial (I) Presented by : Wei-Wen Feng 1/30/2008

CS418 OpenGL & GLUT Programming Tutorial (I) Presented by : Wei-Wen Feng 1/30/2008 CS418 OpenGL & GLUT Programming Tutorial (I) Presented by : Wei-Wen Feng 1/30/2008 2008/2/3 Slide 2 I Am Your TA Name : Wei-Wen Wen Feng 4th Year Graduate Student in Graphics I will be Holding discussion/tutorial

More information

Announcement. 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 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 information