OpenGL An introduction

Size: px
Start display at page:

Download "OpenGL An introduction"

Transcription

1

2 OpenGL An introduction Camilla Berglund Introductory illustration by theodore This material is under a Creative Commons license

3 Requirements Basic ANSI C Basic linear algebra and trigonometry Basic familiarity with common computer graphics terminology

4 Before we begin... This lecture is not complete More states, commands, extensions and object types exist than will be shown here. You can get most of it from the Red Book But this way, you'll know what to look for. Examples are intended to be easily readable Don't confuse them with serious code.

5 Terminology This is a pixel Any questions?

6 What doesn't OpenGL do? Provide a scene graph or 3D-engine. Provide any kind of animation support. Handle input (keyboard, mouse, joystick, time). Handle windows or display modes. Import or export external data formats. Initialise OpenGL (?!) However, this is actually an advantage.

7 So what is OpenGL? A standardised, relatively platform independent, networkable API for rendering of two- and threedimensional graphical primitives, with a structure suitable for hardware acceleration. A portable interface to your 3D-card.

8 Why should you avoid OpenGL? It evolves slower than Direct3D does. It has a lower level of abstraction than Direct3D, and thus requires more work to write a proper rendering engine for. Support for hardware-accelerated OpenGL on Open/Free Unix-systems is still lacking. However, there is always Mesa.

9 Why then use OpenGL? It is standardised and portable. It is (probably) available on your platform. It is easy to get started with. The API is very stable; old code is still relevant. New core functionality tends to be future proof.

10 How does OpenGL evolve? ARB The Architecture Review Board Extension mechanism (ask your API for details) Every OEM and API can add their own extensions as they see fit: GL_NV_foo_bar GL_ARB_baz GLX_glork WGL_ARB_swizzled_quuxes

11 OpenGL is a state machine The old way; fixed pipeline A huge (but static) collection of wheels and knobs. Easy to get started with, lower demands on hardware, but very limiting for advanced rendering. The new way; programmability Large parts of the fixed pipeline can today be replaced by various kinds of programs. These programs can access all relevant states. More work to get started with, but also more flexible.

12 API naming conventions GL_FOO_BAR for constants glfoobar for functions and procedures GLfoobar for data types Suffixes on functions with several variants n specific number of parameters d f i s b specific data type v pointer to one or more values Example: glvertex3fv

13 State commands Setting boolean states glenable, gldisable Setting complex states gllight, glmaterial, gltexenv, glclearcolor, etc... Using the state stack glpushattrib, glpopattrib Retrieving states glgetinteger, glgeterror, glgetlight, etc...

14 #include <GL/glfw.h> int main(void) { if (!glfwinit()) return 1; if (glfwopenwindow(640, 480, 8, 8, 8, 0, 0, 0, GLFW_WINDOW)) { glclearcolor(1.f, 0.f, 0.f, 0.f); while (glfwgetwindowparam(glfw_opened)) { glclear(gl_color_buffer_bit); } } glfwswapbuffers(); glfwterminate(); } return 0;

15 Some nomenclature Vertex A position in space, plus associated attributes Used to define all supported 3D primitive types. Fragment A value from one part of the pixel pipeline. We will only be dealing with color fragments. Pixel The result of combining all relevant fragments. This is what gets written into the framebuffer.

16 Geometric primitives Points Line segments Strip, list, loop Triangles Strip, list, fan Quads (planar only) Strip, list Single polygon (simple, convex, planar only)

17 Line primitives Line loop Line list Line strip

18 Triangle primitives Triangle fan Triangle strip Triangle list

19 Quad primitives Quad list Quad strip

20 Geometric primitive commands Begin rendering glbegin(glenum mode) the desired primitive(s) Vertex attributes glcolor... for vertex color gltexcoord... for texture coordinate glnormal... for vertex normal glvertex... for finalising a vertex End rendering glend()

21 Basic vertex processing Modelview matrix transformation From object space into camera space Projection matrix transformation From camera space into clipping space Clipping to the viewing frustum Including user-defined clipping planes. Perspective divide Viewport transformation

22 Matrix commands Changing the active stack glmatrixmode Working with the stack glpushmatrix, glpopmatrix Working with the current matrix glloadidentity, glmultmatrix, glloadmatrix Commonly used matrix constructions glrotate..., gltranslate..., glscale..., glfrustum glulookat, gluprojection, gluortho2d

23 glmatrixmode(gl_projection); glloadidentity(); gluperspective(60.f, WIDTH / (GLdouble) HEIGHT, 0.1f, 100.f); glmatrixmode(gl_modelview); while (glfwgetwindowparam(glfw_opened)) { glclear(gl_color_buffer_bit); glloadidentity(); gltranslatef(0.f, 0.f, 2.f); glrotatef(glfwgettime() * 50.f, 0.f, 1.f, 0.f); glbegin(gl_triangles); glcolor3f(1.f, 0.f, 0.f); glvertex3f(0.f, 1.f, 0.f); glcolor3f(0.f, 1.f, 0.f); glvertex3f(1.f, 1.f, 0.f); glcolor3f(0.f, 0.f, 1.f); glvertex3f( 1.f, 1.f, 0.f); glend(); } glfwswapbuffers();

24 Lighting Four kinds of light source Spot-, point-, directional and global ambient lights. Fixed number of simultaneous lights But this is can be worked around. Lighting in fixed pipeline is per vertex Fragment programs allow more complex lighting models, as well as per-pixel lighting Lighting formula is basically Phong's model

25 Materials Defines emission and reflectivity parameters Ambient, diffuse and specular reflection. Emission (which does not affect other primitives). Ambient and/or diffuse reflection can be connected to glcolor commands But usually, you specify materials per primitive Texture mapping is better for detailed coloring.

26 n I =k local e i=0 Partial lighting formulas Per vertex for fixed pipeline lighting; programmable pipeline allows better models Note that attenuation isn't shown here I ia k a k d N L i k s V R i s I global =k a I ga I =I local I global

27 Lighting commands Enabling and disabling lighting GL_LIGHTING for global control GL_LIGHTn for individual lights Changing individual light parameters gllight... Changing material properties glmaterial... Changing the lighting model gllightmodel...

28 GLfloat position[4] = { 0.f, 0.f, 1.f, 0.f }; Glfloat color[4] = { 1.f, 0.f, 0.5f, 0.f }; [...] glenable(gl_lighting); glenable(gl_light0); gllightfv(gl_light0, GL_POSITION, position); glmaterialfv(gl_front, GL_DIFFUSE, color); while (...) { [...] draw_cube(); } [...]

29 Some more nomenclature Texel A fragment originating from a texture map, analogous to a framebuffer pixel. Mipmap One of several versions of a texture, used to minimise aliasing errors. Texture space The coordinate system within a texture map, usually but not always in the range [0, 1].

30 Texture mapping Textures are objects accessed through handles Textures can be 1D, 2D, 3D or cube maps Texture coordinates......are per vertex, unless you use fragment programs....address texture space, not object space....have their own transformation matrix stack....can be specified during rendering....can be generated with gltexgen.

31 Texture object commands Managing texture objects glgentextures, glistexture, gldeletetextures Setting the active texture object glbindtexture Setting texture object states gltexparameter... Setting global texture states gltexenv...

32 Texture data commands Writing texture data glteximage2d, gltexsubimage2d Reading texture data glgetteximage Copying from the color buffer glcopyteximage2d, glcopytexsubimage2d All of these exist for 1D (and nowadays 3D)

33 GLuint textureid; glenable(gl_texture_2d); glgentextures(1, &textureid); glbindtexture(gl_texture_2d, textureid); generate_texture(64, 64); glenable(gl_texture_gen_s); glenable(gl_texture_gen_t); gltexgeni(gl_s, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); gltexgeni(gl_t, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); while (...) { [...] draw_cube(); } [...]

34 void generate_texture(unsigned int width, unsigned int height) { GLubyte* data = (GLubyte*) malloc(width * height); /* Insert magic here */ glubuild2dmipmaps(gl_texture_2d, 1, width, height, GL_LUMINANCE, GL_UNSIGNED_BYTE, data); } free(data);

35 Culling A simple form of hidden surface removal. Removes filled primitives based on their winding. Primitives with a certain winding, as it appears during rendering, will be culled when enabled. By default, clockwise winding is culled.

36 Culling commands Global culling control GL_CULL_FACE to glenable/gldisable Deciding which faces to cull glcullface Front, back or both Deciding which face is front glfrontface CW or CCW

37 Blending When blending, pixels are combined with the color buffer instead of simply written to it. This enables effects such as simple transparency. In fixed pipeline, there is a single, fixed formula for combining pixels Unless you have GL_ARB_imaging. s f f s d f f d

38 Blending commands Global blending control GL_BLEND to glenable/gldisable Setting source and destination factors glblendfunc Also, if you have GL_ARB_imaging glblendcolor glblendequation

39 glenable(gl_blend); glblendfunc(gl_one, GL_SRC_ALPHA); while (...) { [...] glloadidentity(); gltranslatef(0.f, 1.f, 4.5f); glrotatef(glfwgettime() * 40.f, 1.f, 1.f, 0.f); draw_cube(); glloadidentity(); gltranslatef(0.6f, 0.f, 3.f); glrotatef(glfwgettime() * 20.f, 1.f, 0.f, 1.f); draw_cube(); glloadidentity(); gltranslatef( 0.2f, 0.2f, 1.5f); glrotatef(glfwgettime() * 50.f, 1.f, 1.f, 1.f); draw_cube(); } [...]

40 Fog Tinting vertices based on distance Fixed pipeline fog has a single color Gives a crude impression of depth Useful for simulating certain atmospheric effects. Three fog formulas Linear, exponential and exponential squared.

41 Fog formulas Exponential Exponential squared Linear Final interpolation f =e density z density z 2 f =e f = end z end start C = f C i 1 f C f

42 Fog commands Global fog control GL_FOG to glenable/gldisable Setting fog parameters glfog... Controlling fog niceness GL_FOG_HINT to glhint

43 struct ColorRGBA color = { 0.8f, 0.8f, 0.7f, 0.f }; glclearcolor(color.r, color.g, color.b, 0.f); glenable(gl_fog); glfogi(gl_fog_mode, GL_LINEAR); glfogf(gl_fog_start, 0.f); glfogf(gl_fog_end, 10.f); glfogfv(gl_fog_color, (GLfloat*) &color); while (...) { glloadidentity(); gltranslatef(1.f, 0.f, 4.f); for (i = 0; i < 5; i++) { gltranslatef(0.f, 0.f, 1.5f); glrotatef(glfwgettime() * 50.f, 1.f, 1.f, 1.f); } draw_cube(); } [...]

44 Buffers Color buffer Depth buffer Z axis distance or eye distance values Stencil buffer Scratch values for dynamic masking effects Accumulation buffer Auxillary buffers

45 Texture / buffer formats Color (RGB) Intensity Luminance Alpha Depth Normal maps Combined or compressed variants of the above

46 Buffer commands Setting clearing values glclearcolor, glcleardepth, glclearstencil, etc... Clearing buffers glclear Masking buffer writes glcolormask, gldepthmask, glstencilmask Limiting writes to a specific area glscissor

47 Display lists Display lists are objects accessed through handles Records and plays back a sequence of commands A display list may call other display lists The surrounding state is not saved This may radically change the result of your list May save both coding and execution time Pure vertex display lists are often accelerated However, there are better ways to achieve this now

48 Display list commands Creating lists glgenlists Recording lists glnewlist, glendlist Calling lists glcalllist, glcalllists Destroying lists gldeletelists

49 Gluint listid; [...] listid = glgenlists(1); glnewlist(listid, GL_COMPILE); for (x = 0; x < 2; x++) { for (y = 0; y < 2; y++) { for (z = 0; z < 2; z++) { glpushmatrix(); gltranslatef(x * 2.f 1.f, y * 2.f 1.f, z * 2.f 1.f); draw_cube(); glpopmatrix(); } } } glendlist();

50 Reading an extension Very standardised format Dependencies Overview, Reasoning, Issues New Procedures and Functions, New Tokens Additions to Chapter n of the OpenGL x.x Specification Interactions with extension Errors New state

51 Various access methods GLUT (original or FreeGLUT) SDL, GLFW, Prophecy, etc... Bindings exist for Ada, C#, Java, Ruby, Python, PHP and most other languages Most GUI-toolkits provide access to OpenGL The hard way (GLX, AGL, CGL, WGL, NSOpenGL, etc...) Never, ever use GLAUX!

52 Resources The Red Book (programmer's guide) Version 1.1 is available on the Internet The specification is always free The OpenGL extension registry NeHe Productions and GameDev.net KTHB and other libraries Google is your friend IRC ( ##opengl on Freenode )

53 The End Thank you for your time Now go make something cool

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

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

More information

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

OpenGL: Open Graphics Library. Introduction to OpenGL Part II. How do I render a geometric primitive? What is OpenGL

OpenGL: Open Graphics Library. Introduction to OpenGL Part II. How do I render a geometric primitive? What is OpenGL OpenGL: Open Graphics Library Introduction to OpenGL Part II CS 351-50 Graphics API ( Application Programming Interface) Software library Layer between programmer and graphics hardware (and other software

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

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

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

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

Introduction to OpenGL

Introduction to OpenGL Introduction to OpenGL 1995-2015 Josef Pelikán & Alexander Wilkie CGG MFF UK Praha pepca@cgg.mff.cuni.cz http://cgg.mff.cuni.cz/~pepca/ 1 / 31 Advances in Hardware 3D acceleration is a common feature in

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

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

E.Order of Operations

E.Order of Operations Appendix E E.Order of Operations This book describes all the performed between initial specification of vertices and final writing of fragments into the framebuffer. The chapters of this book are arranged

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

// 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

Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches:

Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches: Surface Graphics Objects are explicitely defined by a surface or boundary representation (explicit inside vs outside) This boundary representation can be given by: - a mesh of polygons: 200 polys 1,000

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

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

MB86290 Series 3D Graphics Library V02 User Manual The core API

MB86290 Series 3D Graphics Library V02 User Manual The core API MB86290 Series 3D Graphics Library V02 User Manual The core API Revision 1.0 Copyright FUJITSU LIMITED 1999-2003 ALL RIGHTS RESERVED 1. The specifications in this manual are subject to change without notice.

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

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

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

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

More information

Introduction to OpenGL Transformations, Viewing and Lighting. Ali Bigdelou

Introduction to OpenGL Transformations, Viewing and Lighting. Ali Bigdelou Introduction to OpenGL Transformations, Viewing and Lighting Ali Bigdelou Modeling From Points to Polygonal Objects Vertices (points) are positioned in the virtual 3D scene Connect points to form polygons

More information

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

CSE 690: GPGPU. Lecture 2: Understanding the Fabric - Intro to Graphics. Klaus Mueller Stony Brook University Computer Science Department

CSE 690: GPGPU. Lecture 2: Understanding the Fabric - Intro to Graphics. Klaus Mueller Stony Brook University Computer Science Department CSE 690: GPGPU Lecture 2: Understanding the Fabric - Intro to Graphics Klaus Mueller Stony Brook University Computer Science Department Klaus Mueller, Stony Brook 2005 1 Surface Graphics Objects are explicitely

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

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

OpenGL. White Square Code 11/4/09. OpenGL. OpenGL. OpenGL

OpenGL. White Square Code 11/4/09. OpenGL. OpenGL. OpenGL OpenGL OpenGL OpenGL Is a mechanism to create images in a frame buffer Is an API to access that mechanism Is well specified OpenGL Is not a window system Is not a user interface Is not a display mechanism

More information

INF3320 Computer Graphics and Discrete Geometry

INF3320 Computer Graphics and Discrete Geometry INF3320 Computer Graphics and Discrete Geometry The OpenGL pipeline Christopher Dyken and Martin Reimers 07.10.2009 Page 1 The OpenGL pipeline Real Time Rendering: The Graphics Processing Unit (GPU) (Chapter

More information

Lecture 5: Viewing. CSE Computer Graphics (Fall 2010)

Lecture 5: Viewing. CSE Computer Graphics (Fall 2010) Lecture 5: Viewing CSE 40166 Computer Graphics (Fall 2010) Review: from 3D world to 2D pixels 1. Transformations are represented by matrix multiplication. o Modeling o Viewing o Projection 2. Clipping

More information

Computer Graphics Programming

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

More information

Lectures Transparency Case Study

Lectures Transparency Case Study Lectures Transparency Case Study 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 How

More information

Lecture 2. Determinants. Ax = 0. a 11 x 1 + a 12 x a 1n x n = 0 a 21 x 1 + a 22 x a 2n x n = 0

Lecture 2. Determinants. Ax = 0. a 11 x 1 + a 12 x a 1n x n = 0 a 21 x 1 + a 22 x a 2n x n = 0 A = a 11 a 12... a 1n a 21 a 22... a 2n. a n1 a n2... a nn x = x 1 x 2. x n Lecture 2 Math Review 2 Introduction to OpenGL Ax = 0 a 11 x 1 + a 12 x 2 +... + a 1n x n = 0 a 21 x 1 + a 22 x 2 +... + a 2n

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

Draw the basic Geometry Objects. Hanyang University

Draw 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 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

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

Models and Architectures

Models and Architectures Models and Architectures Objectives Learn the basic design of a graphics system Introduce graphics pipeline architecture Examine software components for an interactive graphics system 1 Image Formation

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

Lecture 07: Buffers and Textures

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

More information

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

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

OpenGL & Visualization

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

More information

cs123 Lab 3 OpenGL Part One 1 Introduction 2 OpenGL Basics 2.2 The Rendering Pipeline 2.1 The CPU and the GPU 2.3 Basic Syntax of OpenGL commands

cs123 Lab 3 OpenGL Part One 1 Introduction 2 OpenGL Basics 2.2 The Rendering Pipeline 2.1 The CPU and the GPU 2.3 Basic Syntax of OpenGL commands cs123 Lab 3 OpenGL Part One Introduction to Computer Graphics 1 Introduction From now on, our weekly labs will focus on the use of OpenGL. While the lectures and projects will let you get a deeper understanding

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

Visualizing Molecular Dynamics

Visualizing Molecular Dynamics Visualizing Molecular Dynamics Aiichiro Nakano Collaboratory for Advanced Computing & Simulations Department of Computer Science Department of Physics & Astronomy Department of Chemical Engineering & Materials

More information

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

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer Real-Time Rendering (Echtzeitgraphik) Michael Wimmer wimmer@cg.tuwien.ac.at Walking down the graphics pipeline Application Geometry Rasterizer What for? Understanding the rendering pipeline is the key

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

OpenGL Transformations

OpenGL Transformations OpenGL Transformations R. J. Renka Department of Computer Science & Engineering University of North Texas 02/18/2014 Introduction The most essential aspect of OpenGL is the vertex pipeline described in

More information

Lecture 4 Advanced Computer Graphics (CS & SE )

Lecture 4 Advanced Computer Graphics (CS & SE ) Lecture 4 Advanced Computer Graphics (CS & SE 233.420) Topics Covered Animation Matrices Viewing Lighting Animating Interactive Programs Consider planet.c Want to animate rotating the Earth around the

More information

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

INF3320 Computer Graphics and Discrete Geometry

INF3320 Computer Graphics and Discrete Geometry INF3320 Computer Graphics and Discrete Geometry Texturing Christopher Dyken Martin Reimers 06.10.2010 Page 1 Texturing Linear interpolation Real Time Rendering: Chapter 5: Visual Appearance Chapter 6:

More information

Module 13C: Using The 3D Graphics APIs OpenGL ES

Module 13C: Using The 3D Graphics APIs OpenGL ES Module 13C: Using The 3D Graphics APIs OpenGL ES BREW TM Developer Training Module Objectives See the steps involved in 3D rendering View the 3D graphics capabilities 2 1 3D Overview The 3D graphics library

More information

CONTENTS... 1 OPENGL REFERENCE MANUAL...

CONTENTS... 1 OPENGL REFERENCE MANUAL... Contents CONTENTS... 1 OPENGL REFERENCE MANUAL... 5 THE OFFICIAL REFERENCE DOCUMENT FOR OPENGL, RELEASE 1... 5 PREFACE... 6 WHAT YOU SHOULD KNOW BEFORE READING THIS MANUAL... 6 ACKNOWLEDGMENTS... 7 CHAPTER

More information

Rasterization Overview

Rasterization Overview Rendering Overview The process of generating an image given a virtual camera objects light sources Various techniques rasterization (topic of this course) raytracing (topic of the course Advanced Computer

More information

Methodology for Lecture. Importance of Lighting. Outline. Shading Models. Brief primer on Color. Foundations of Computer Graphics (Spring 2010)

Methodology for Lecture. Importance of Lighting. Outline. Shading Models. Brief primer on Color. Foundations of Computer Graphics (Spring 2010) Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 11: OpenGL 3 http://inst.eecs.berkeley.edu/~cs184 Methodology for Lecture Lecture deals with lighting (teapot shaded as in HW1) Some Nate

More information

EECE 478. Learning Objectives. Learning Objectives. Rasterization & Scenes. Rasterization. Compositing

EECE 478. Learning Objectives. Learning Objectives. Rasterization & Scenes. Rasterization. Compositing EECE 478 Rasterization & Scenes Rasterization Learning Objectives Be able to describe the complete graphics pipeline. Describe the process of rasterization for triangles and lines. Compositing Manipulate

More information

New Concepts. Loading geometry from file Camera animation Advanced lighting and materials Texture mapping Display lists

New Concepts. Loading geometry from file Camera animation Advanced lighting and materials Texture mapping Display lists Terrain Rendering New Concepts Loading geometry from file Camera animation Advanced lighting and materials Texture mapping Display lists Loading geometry from file Motivations: Built-in geometry is limited

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

OpenGL Performances and Flexibility. Visual Computing Laboratory ISTI CNR, Italy

OpenGL Performances and Flexibility. Visual Computing Laboratory ISTI CNR, Italy OpenGL Performances and Flexibility Visual Computing Laboratory ISTI CNR, Italy The Abstract Graphics Pipeline Application 1. The application specifies vertices & connectivity. Vertex Processing 2. The

More information

Normalized Device Coordinate System (NDC) World Coordinate System. Example Coordinate Systems. Device Coordinate System

Normalized Device Coordinate System (NDC) World Coordinate System. Example Coordinate Systems. Device Coordinate System World Coordinate System Normalized Device Coordinate System (NDC) Model Program Graphics System Workstation Model Program Graphics System Workstation Normally, the User or Object Coordinate System. World

More information

World Coordinate System

World Coordinate System World Coordinate System Application Model Application Program Graphics System Workstation Normally, the User or Object Coordinate System. World Coordinate Window: A subset of the world coordinate system,

More information

OpenGL Performances and Flexibility

OpenGL Performances and Flexibility OpenGL Performances and Flexibility Marco Di Benedetto Visual Computing Laboratory ISTI CNR, Italy OpenGL Roadmap 1.0 - Jan 1992 - First Version 1.1 - Jan 1997 - Vertex Arrays, Texture Objects 1.2 - Mar

More information

Display Lists. Conceptually similar to a graphics file. In client-server environment, display list is placed on server

Display Lists. Conceptually similar to a graphics file. In client-server environment, display list is placed on server Display Lists Conceptually similar to a graphics file Must define (name, create) Add contents Close In client-server environment, display list is placed on server Can be redisplayed without sending primitives

More information

Rendering Pipeline/ OpenGL

Rendering Pipeline/ OpenGL Chapter 2 Basics of Computer Graphics: Your tasks for the weekend Piazza Discussion Group: Register Post review questions by Mon noon Use private option, rev1 tag Start Assignment 1 Test programming environment

More information

Grafica Computazionale

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

More information

Introduction to OpenGL

Introduction to OpenGL OpenGL is an alternative to Direct3D for 3D graphics rendering Originally developed by Silicon Graphics Inc (SGI), turned over to multi-vendor group (OpenGL Architecture Review Board) in 1992 Unlike DirectX,

More information

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

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

More information

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

Letterkenny Institute of Technology

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

More information

Outline. Other Graphics Technology. OpenGL Background and History. Platform Specifics. The Drawing Process

Outline. Other Graphics Technology. OpenGL Background and History. Platform Specifics. The Drawing Process Outline 433-380 Graphics and Computation Introduction to OpenGL OpenGL Background and History Other Graphics Technology Drawing Viewing and Transformation Lighting GLUT Resources Some images in these slides

More information

Graphics and Computation Introduction to OpenGL

Graphics and Computation Introduction to OpenGL 433-380 Graphics and Computation Introduction to OpenGL Some images in these slides are taken from The OpenGL Programming Manual, which is copyright Addison Wesley and the OpenGL Architecture Review Board.

More information

CSCI E-74. Simulation and Gaming

CSCI E-74. Simulation and Gaming CSCI E-74 Virtual and Augmented Reality for Simulation and Gaming Fall term 2017 Gianluca De Novi, PhD Lesson 7 Multi Texturing Data Structures in a 3D Engine Vertices/Vectors Segments Matrices Polygons

More information

CSE 167: Lecture #8: Lighting. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

CSE 167: Lecture #8: Lighting. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011 CSE 167: Introduction to Computer Graphics Lecture #8: Lighting Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011 Announcements Homework project #4 due Friday, October 28 Introduction:

More information

Introduction to Computer Graphics with WebGL

Introduction to Computer Graphics with WebGL Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science Laboratory University of New Mexico Models and Architectures

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

Computer Graphics. Chapter 10 Three-Dimensional Viewing

Computer Graphics. Chapter 10 Three-Dimensional Viewing Computer Graphics Chapter 10 Three-Dimensional Viewing Chapter 10 Three-Dimensional Viewing Part I. Overview of 3D Viewing Concept 3D Viewing Pipeline vs. OpenGL Pipeline 3D Viewing-Coordinate Parameters

More information

Models and Architectures. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Models and Architectures. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Objectives Learn the basic design of a graphics system Introduce

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

Pixels and Buffers. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Pixels and Buffers. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Pixels and Buffers CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1 Objectives Introduce additional OpenGL buffers Learn to read from / write to buffers Introduce

More information

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

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

More information

Computer Graphics: Programming, Problem Solving, and Visual Communication

Computer Graphics: Programming, Problem Solving, and Visual Communication Computer Graphics: Programming, Problem Solving, and Visual Communication Dr. Steve Cunningham Computer Science Department California State University Stanislaus Turlock, CA 95382 copyright 2002, Steve

More information

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

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

More information

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

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

More information

Better Interactive Programs

Better Interactive Programs Better Interactive Programs Objectives Learn to build more sophisticated interactive programs using Picking Select objects from the display Rubberbanding Interactive drawing of lines and rectangles Display

More information

1 (Practice 1) Introduction to OpenGL

1 (Practice 1) Introduction to OpenGL 1 (Practice 1) Introduction to OpenGL This first practical is intended to get you used to OpenGL command. It is mostly a copy/paste work. Try to do it smartly by tweaking and messing around with parameters,

More 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

Texture Mapping and Special Effects

Texture Mapping and Special Effects Texture Mapping and Special Effects February 23 rd 26 th 2007 MAE 410-574, Virtual Reality Applications and Research Instructor: Govindarajan Srimathveeravalli HW#5 Due March 2 nd Implement the complete

More information

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

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

Lectures Display List

Lectures Display List Lectures Display List By Tom Duff Pixar Animation Studios Emeryville, California and George Ledin Jr Sonoma State University Rohnert Park, California 2004, Tom Duff and George Ledin Jr 1 What is it? What

More information

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

Scientific Visualization Basics

Scientific Visualization Basics Scientific Visualization Basics Aiichiro Nakano Collaboratory for Advanced Computing & Simulations Dept. of Computer Science, Dept. of Physics & Astronomy, Dept. of Chemical Engineering & Materials Science,

More information

Texture Mapping. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Texture Mapping. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Texture Mapping CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1 Objectives Introduce Mapping Methods - Texture Mapping - Environment Mapping - Bump Mapping Consider

More information

Transformation Pipeline

Transformation Pipeline Transformation Pipeline Local (Object) Space Modeling World Space Clip Space Projection Eye Space Viewing Perspective divide NDC space Normalized l d Device Coordinatesd Viewport mapping Screen space Coordinate

More information

Graphical Objects and Scene Graphs

Graphical Objects and Scene Graphs Graphical Objects and Scene Graphs Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Objectives Introduce graphical objects Generalize

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

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

1.2.3 The Graphics Hardware Pipeline

1.2.3 The Graphics Hardware Pipeline Figure 1-3. The Graphics Hardware Pipeline 1.2.3 The Graphics Hardware Pipeline A pipeline is a sequence of stages operating in parallel and in a fixed order. Each stage receives its input from the prior

More information