Copyright Khronos Group 2012 Page 1. Teaching GL. Dave Shreiner Director, Graphics and GPU Computing, ARM 1 December 2012

Size: px
Start display at page:

Download "Copyright Khronos Group 2012 Page 1. Teaching GL. Dave Shreiner Director, Graphics and GPU Computing, ARM 1 December 2012"

Transcription

1 Copyright Khronos Group 2012 Page 1 Teaching GL Dave Shreiner Director, Graphics and GPU Computing, ARM 1 December 2012

2 Copyright Khronos Group 2012 Page 2 Agenda Overview of OpenGL family of APIs Comparison of rendering pipelines Debugging the most common OpenGL usage errors

3 Copyright Khronos Group 2012 Page 3 The OpenGL Family OpenGL - The cross-platform standard for 3D Graphics OpenGL ES - The standard for embedded 3D Graphics WebGL - Bringing interactive 3D graphics to the Web through a JavaScript interface OpenGL SC - Verified 3D graphics API for safety critical applications - significantly different pipeline than the others - (not discussed in this session)

4 Copyright Khronos Group 2012 Page 4 The Fundamental Rendering Pipeline Geometric Data (positions, colors, texture coordinates, etc.) Vertex Shading Rasterizer Fragment Shading Pixel Data (textures, etc.) This is the pipeline that OpenGL ES and WebGL expose. OpenGL extends the pipeline.

5 Copyright Khronos Group 2012 Page 5 The OpenGL 4.3 Rendering Pipeline Geometric Data (positions, colors, texture coordinates, etc.) Vertex Shading Tessellation Shading Geometry Shading Pixel Data (textures, etc.) Compute Shading Rasterizer Fragment Shading

6 Copyright Khronos Group 2012 Page 6 A Few Basics Will Go a Long Way All of the APIs are shader based - they use variants of the OpenGL Shading Language GLSL - up porting (from ES or WebGL) to OpenGL shouldn t require any work - down porting may require a few changes Always storing you data in buffer objects will guarantee portability and performance - there are a few differences that you ll need to keep in mind You ll also need to know a little linear algebra Now, to introduce a few introductory concepts

7 Copyright Khronos Group 2012 Page 7 Representing Geometric Objects Geometric objects in OpenGL are represented using vertices A vertex is a collection of generic attributes - positional coordinates - colors - texture coordinates - any other data associated with that point in space Positions are stored as 4-dimensional homogeneous coordinates Vertex data must be stored in vertex buffer objects (VBOs) VBOs must be stored in vertex array objects (VAOs) (OpenGL only) x y z w

8 How Data Flows through GLSL Shaders attributes (in) are the inputs into vertex shaders varyings (out) outputs of vertex shaders and inputs into fragment shaders uniforms are constants available to any shader stage uniform API attribute GLSL Keyword varying OpenGL in out ES / WebGL attribute varying For OpenGL, all shader stages use in for all inputs into a shader out for all outputs from a shader 8 Vertex Shader Fragment Shader attribute varying fragments Copyright Khronos Group 2012 Page 8

9 Copyright Khronos Group 2012 Page 9 Anatomy of a Simple Vertex Shader (OpenGL version) in vec4 vposition; in vec4 vcolor; out vec4 color; void main() { color = vcolor; gl_position = vertex; }

10 Copyright Khronos Group 2012 Page 10 Anatomy of a Simple Vertex Shader (ES/WebGL version) attribute vec4 vposition; attribute vec4 vcolor; varying vec4 color; void main() { color = vcolor; gl_position = vertex; }

11 Copyright Khronos Group 2012 Page 11 Anatomy of a Simple Fragment Shader (OpenGL version) in vec4 vcolor; out vec4 color; void main() { color = vcolor; }

12 Copyright Khronos Group 2012 Page 12 Anatomy of a Simple Fragment Shader (ES/WebGL version) varying vec4 color; void main() { gl_fragcolor = color; }

13 Copyright Khronos Group 2012 Page 13 Getting Your Shaders into OpenGL Shaders need to be compiled and linked to form an executable shader program OpenGL provides the compiler and linker - you access them by making function calls to the API A program must contain - one vertex shader - one fragment shader - other shader stages are optional (OpenGL only) Create Program Create Shader Load Shader Source Compile Shader Attach Shader to Program Link Program glcreateprogram() glcreateshader() glshadersource() glcompileshader() glattachshader() gllinkprogram() These steps need to be repeated for each type of shader in the shader program Use Program gluseprogram()

14 Copyright Khronos Group 2012 Page 14 OpenGL Shader Plumbing You need to make several connections to get data into the pipeline - only need to do this attributes varyings take care of themselves vposition[0] in vec4 vposition; in vec4 vcolor; out vec4 color; void main() { gl_position = vposition; color = vcolor; } Shader Compilation Variable Name Attribute Index vposition 12 vcolor 2 vcolor[0] vposition[1] vcolor[1] vposition[2] vcolor[2] vposition[3] vcolor[3]

15 Copyright Khronos Group 2012 Page 15 OpenGL Shader Plumbing You need to make several connections to get data into the pipeline - only need to do this attributes varyings take care of themselves vposition[0] in vec4 vposition; in vec4 vcolor; out vec4 color; void main() { gl_position = vposition; color = vcolor; } glgetattriblocation vcolor[0] vposition[1] vcolor[1] vposition[2] vcolor[2] vposition[3] vcolor[3] Variable Name Attribute Index vposition 12 vcolor 2

16 Copyright Khronos Group 2012 Page 16 OpenGL Shader Plumbing You need to make several connections to get data into the pipeline - only need to do this attributes varyings take care of themselves vposition[0] in vec4 vposition; in vec4 vcolor; out vec4 color; void main() { gl_position = vposition; color = vcolor; } glvertexattribpointer vcolor[0] vposition[1] vcolor[1] vposition[2] vcolor[2] vposition[3] vcolor[3] Variable Name Attribute Index vposition 12 vcolor 2

17 Debugging the Most Common Problems Copyright Khronos Group 2012 Page 17

18 Copyright Khronos Group 2012 Page 18 The Bind-to-Edit Model OpenGL uses objects for storing data - it s loosely modeled on object-oriented programming, but not quite Objects are implicitly specified by a binding operation - glbind*() calls Objects are usually bound twice: 1. object creation and initialization 2. specification as a data source for OpenGL rendering This most often causes problems for novice programmers - they forget the second binding (to use the data), or - they re bound to the wrong object

19 Copyright Khronos Group 2012 Page 19 Where are my objects? There are many steps that are required to have geometry show in a window The following must all occur correctly: 1. specifying data into vertex arrays 2. compiling and linking shaders 3. associating vertex attributes with shader variables 4. specifying the viewport 5. loading uniform variables for shader use 6. transforming and projecting geometry into the viewport 7. passing the transformed vertices out of the vertex shader Where should you start looking?

20 Copyright Khronos Group 2012 Page 20 Verifying Your Data s Getting Into OpenGL You can use Normalized Device Coordinates (NDCs) to make sure data s flowing correctly - x and y need to be between -1.0 and z needs to be between 0.0 and 1.0 Verify using very simple vertex and fragment shaders - often called a pass-thru shader in vec4 vpos; void main() { gl_position = vpos; } If your test geometry shows up, then you know: - data is correctly specified to OpenGL - attributes are correctly specified and enabled - shaders compiled and linked successfully - viewport is correctly specified out vec4 color; void main() { color = vec4(1); }

21 Copyright Khronos Group 2012 Page 21 OpenGL Matrices for C Programmers Matrices in OpenGL are column-major - this is the exact opposite of how C programmers think There are many places were a matrix s transpose can be introduced - in the application (most straightforward) - when specifying the matrix as a uniform gluniformmatrix(, GL_TRUE, ); - in the shader - column_major qualifier in GLSL - transpose() method in GLSL é ê êê M = ê ê ë m 0 m 4 m 8 m 12 m 1 m 5 m 9 m 13 m 2 m 6 m 10 m 14 m 3 m 7 m 11 m 15 ù ú úú ú ú û

22 Copyright Khronos Group 2012 Page 22 Matrix Multiplication Is Not Commutative Vertices are usually transformed by 4 4 matrices - modeling and viewing transformations - projection transformations Vertices should be multiplied on right of a matrix v' = Mv Matrices should be accumulated on the right as well C(BA)

23 Where Are My Textures? Loading an image to use as a texture in OpenGL is easy - use the glteximage*d call - loads a single texture level - levels are fundamental to a technique called mipmapping Sampling controls how colors are retrieved from a texture map - including whether mipmaps are to be used However, OpenGL s default sampling mode require mipmaps Three potential solutions: - change the sampling mode: gltexparameteri(, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - load more mipmap levels - automatically build mipmaps: glgeneratemipmaps() Copyright Khronos Group 2012 Page 23

24 Copyright Khronos Group 2012 Page 24 Why Do My Textures Looked Skewed? glteximage2d transfers pixels form an application s memory into OpenGL - various parameters are used to control which addresses are read from All of those parameters are controlled by the glpixelstrore function The default mode is to assume every pixel starts on a four-byte boundary - makes sense for RGBA 8-bit per component images - but, a lot of images are RGB only (and have a three-byte stride) Adjust the GL_UNPACK_ALIGNMENT to 1 - default is 4-1 specifies byte alignment

25 Thanks! Copyright Khronos Group 2012 Page 25

CS475/CS675 - Computer Graphics. OpenGL Drawing

CS475/CS675 - Computer Graphics. OpenGL Drawing CS475/CS675 - Computer Graphics OpenGL Drawing What is OpenGL? Open Graphics Library API to specify geometric objects in 2D/3D and to control how they are rendered into the framebuffer. A software interface

More information

Programming shaders & GPUs Christian Miller CS Fall 2011

Programming shaders & GPUs Christian Miller CS Fall 2011 Programming shaders & GPUs Christian Miller CS 354 - Fall 2011 Fixed-function vs. programmable Up until 2001, graphics cards implemented the whole pipeline for you Fixed functionality but configurable

More information

We assume that you are familiar with the following:

We assume that you are familiar with the following: We will use WebGL 1.0. WebGL 2.0 is now being supported by most browsers but requires a better GPU so may not run on older computers or on most cell phones and tablets. See http://webglstats.com/. We will

More information

Graphics Programming. Computer Graphics, VT 2016 Lecture 2, Chapter 2. Fredrik Nysjö Centre for Image analysis Uppsala University

Graphics Programming. Computer Graphics, VT 2016 Lecture 2, Chapter 2. Fredrik Nysjö Centre for Image analysis Uppsala University Graphics Programming Computer Graphics, VT 2016 Lecture 2, Chapter 2 Fredrik Nysjö Centre for Image analysis Uppsala University Graphics programming Typically deals with How to define a 3D scene with a

More information

COMP371 COMPUTER GRAPHICS

COMP371 COMPUTER GRAPHICS COMP371 COMPUTER GRAPHICS SESSION 12 PROGRAMMABLE SHADERS Announcement Programming Assignment #2 deadline next week: Session #7 Review of project proposals 2 Lecture Overview GPU programming 3 GPU Pipeline

More information

We will use WebGL 1.0. WebGL 2.0 is now being supported by most browsers but requires a better GPU so may not run on older computers or on most cell

We will use WebGL 1.0. WebGL 2.0 is now being supported by most browsers but requires a better GPU so may not run on older computers or on most cell We will use WebGL 1.0. WebGL 2.0 is now being supported by most browsers but requires a better GPU so may not run on older computers or on most cell phones and tablets. See http://webglstats.com/. We will

More information

OpenGL pipeline Evolution and OpenGL Shading Language (GLSL) Part 2/3 Vertex and Fragment Shaders

OpenGL pipeline Evolution and OpenGL Shading Language (GLSL) Part 2/3 Vertex and Fragment Shaders OpenGL pipeline Evolution and OpenGL Shading Language (GLSL) Part 2/3 Vertex and Fragment Shaders Prateek Shrivastava CS12S008 shrvstv@cse.iitm.ac.in 1 GLSL Data types Scalar types: float, int, bool Vector

More information

CS452/552; EE465/505. Review & Examples

CS452/552; EE465/505. Review & Examples CS452/552; EE465/505 Review & Examples 2-05 15 Outline Review and Examples:! Shaders, Buffers & Binding! Example: Draw 3 Triangles Vertex lists; gl.drawarrays( ) Edge lists: gl.drawelements( )! Example:

More information

WebGL A quick introduction. J. Madeira V. 0.2 September 2017

WebGL A quick introduction. J. Madeira V. 0.2 September 2017 WebGL A quick introduction J. Madeira V. 0.2 September 2017 1 Interactive Computer Graphics Graphics library / package is intermediary between application and display hardware Application program maps

More information

OPENGL RENDERING PIPELINE

OPENGL RENDERING PIPELINE CPSC 314 03 SHADERS, OPENGL, & JS UGRAD.CS.UBC.CA/~CS314 Textbook: Appendix A* (helpful, but different version of OpenGL) Alla Sheffer Sep 2016 OPENGL RENDERING PIPELINE 1 OPENGL RENDERING PIPELINE Javascript

More information

CS 432 Interactive Computer Graphics

CS 432 Interactive Computer Graphics CS 432 Interactive Computer Graphics Lecture 2 Part 2 Introduction to Shaders Matt Burlick - Drexel University - CS 432 1 Shaders To understand shaders, let s look at the graphics pipeline again The job

More information

BCA611 Video Oyunları için 3B Grafik

BCA611 Video Oyunları için 3B Grafik BCA611 Video Oyunları için 3B Grafik WebGL - Shader Programming Zümra Kavafoğlu Canvas element The HTML element is used to draw graphics on a web page. Create canvas with id, width and height

More information

Lecture 5 Vertex and Fragment Shaders-1. CITS3003 Graphics & Animation

Lecture 5 Vertex and Fragment Shaders-1. CITS3003 Graphics & Animation Lecture 5 Vertex and Fragment Shaders-1 CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives The rendering pipeline and the shaders Data

More information

Rendering Objects. Need to transform all geometry then

Rendering Objects. Need to transform all geometry then Intro to OpenGL Rendering Objects Object has internal geometry (Model) Object relative to other objects (World) Object relative to camera (View) Object relative to screen (Projection) Need to transform

More information

Lecture 09: Shaders (Part 1)

Lecture 09: Shaders (Part 1) Lecture 09: Shaders (Part 1) CSE 40166 Computer Graphics Peter Bui University of Notre Dame, IN, USA November 9, 2010 OpenGL Rendering Pipeline OpenGL Rendering Pipeline (Pseudo-Code) 1 f o r gl_vertex

More information

CS452/552; EE465/505. Image Processing Frame Buffer Objects

CS452/552; EE465/505. Image Processing Frame Buffer Objects CS452/552; EE465/505 Image Processing Frame Buffer Objects 3-12 15 Outline! Image Processing: Examples! Render to Texture Read: Angel, Chapter 7, 7.10-7.13 Lab3 new due date: Friday, Mar. 13 th Project#1

More information

Advanced Graphics. The Shader knows. Alex Benton, University of Cambridge Supported in part by Google UK, Ltd

Advanced Graphics. The Shader knows. Alex Benton, University of Cambridge Supported in part by Google UK, Ltd Advanced Graphics The Shader knows Alex Benton, University of Cambridge A.Benton@damtp.cam.ac.uk Supported in part by Google UK, Ltd What is the shader? Local space World space Viewing space Local space

More information

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE UGRAD.CS.UBC.C A/~CS314 Mikhail Bessmeltsev 1 WHAT IS RENDERING? Generating image from a 3D scene 2 WHAT IS RENDERING? Generating image

More information

CS452/552; EE465/505. Texture Mapping in WebGL

CS452/552; EE465/505. Texture Mapping in WebGL CS452/552; EE465/505 Texture Mapping in WebGL 2-26 15 Outline! Texture Mapping in WebGL Read: Angel, Chapter 7, 7.3-7.5 LearningWebGL lesson 5: http://learningwebgl.com/blog/?p=507 Lab3 due: Monday, 3/2

More information

CPSC 436D Video Game Programming

CPSC 436D Video Game Programming CPSC 436D Video Game Programming OpenGL/Shaders Opengl RENDERING PIPELINE Copyright: Alla Sheffer 1 Opengl RENDERING PIPELINE C/C++ OpenGL GLSL (automatic) (automatic) GLSL (automatic) opengl Low-level

More information

WebGL and GLSL Basics. CS559 Fall 2015 Lecture 10 October 6, 2015

WebGL and GLSL Basics. CS559 Fall 2015 Lecture 10 October 6, 2015 WebGL and GLSL Basics CS559 Fall 2015 Lecture 10 October 6, 2015 Last time Hardware Rasterization For each point: Compute barycentric coords Decide if in or out.7,.7, -.4 1.1, 0, -.1.9,.05,.05.33,.33,.33

More information

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

Buffers. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015 Buffers 1 Objectives Introduce additional WebGL buffers Reading and writing buffers Buffers and Images 2 Buffer Define a buffer by its spatial resolution (n x m) and its depth (or precision) k, the number

More information

Programming with OpenGL Part 3: Shaders. Ed Angel Professor of Emeritus of Computer Science University of New Mexico

Programming with OpenGL Part 3: Shaders. Ed Angel Professor of Emeritus of Computer Science University of New Mexico Programming with OpenGL Part 3: Shaders Ed Angel Professor of Emeritus of Computer Science University of New Mexico 1 Objectives Simple Shaders - Vertex shader - Fragment shaders Programming shaders with

More information

Mobile Application Programing: Android. OpenGL Operation

Mobile Application Programing: Android. OpenGL Operation Mobile Application Programing: Android OpenGL Operation Activities Apps are composed of activities Activities are self-contained tasks made up of one screen-full of information Activities start one another

More information

Lecture 13: OpenGL Shading Language (GLSL)

Lecture 13: OpenGL Shading Language (GLSL) Lecture 13: OpenGL Shading Language (GLSL) COMP 175: Computer Graphics April 18, 2018 1/56 Motivation } Last week, we discussed the many of the new tricks in Graphics require low-level access to the Graphics

More information

The Graphics Pipeline

The Graphics Pipeline The Graphics Pipeline Lecture 2 Robb T. Koether Hampden-Sydney College Fri, Aug 28, 2015 Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Fri, Aug 28, 2015 1 / 19 Outline 1 Vertices 2 The

More information

Shaders. Slide credit to Prof. Zwicker

Shaders. Slide credit to Prof. Zwicker Shaders Slide credit to Prof. Zwicker 2 Today Shader programming 3 Complete model Blinn model with several light sources i diffuse specular ambient How is this implemented on the graphics processor (GPU)?

More information

The Graphics Pipeline

The Graphics Pipeline The Graphics Pipeline Lecture 2 Robb T. Koether Hampden-Sydney College Wed, Aug 23, 2017 Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 1 / 19 Outline 1 Vertices 2 The

More information

CS4621/5621 Fall Computer Graphics Practicum Intro to OpenGL/GLSL

CS4621/5621 Fall Computer Graphics Practicum Intro to OpenGL/GLSL CS4621/5621 Fall 2015 Computer Graphics Practicum Intro to OpenGL/GLSL Professor: Kavita Bala Instructor: Nicolas Savva with slides from Balazs Kovacs, Eston Schweickart, Daniel Schroeder, Jiang Huang

More information

CISC 3620 Lecture 7 Lighting and shading. Topics: Exam results Buffers Texture mapping intro Texture mapping basics WebGL texture mapping

CISC 3620 Lecture 7 Lighting and shading. Topics: Exam results Buffers Texture mapping intro Texture mapping basics WebGL texture mapping CISC 3620 Lecture 7 Lighting and shading Topics: Exam results Buffers Texture mapping intro Texture mapping basics WebGL texture mapping Exam results Grade distribution 12 Min: 26 10 Mean: 74 8 Median:

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

CS 432 Interactive Computer Graphics

CS 432 Interactive Computer Graphics CS 432 Interactive Computer Graphics Lecture 7 Part 2 Texture Mapping in OpenGL Matt Burlick - Drexel University - CS 432 1 Topics Texture Mapping in OpenGL Matt Burlick - Drexel University - CS 432 2

More information

WebGL and GLSL Basics. CS559 Fall 2016 Lecture 14 October

WebGL and GLSL Basics. CS559 Fall 2016 Lecture 14 October WebGL and GLSL Basics CS559 Fall 2016 Lecture 14 October 24 2016 Review Hardware Rasterization For each point: Compute barycentric coords Decide if in or out.7,.7, -.4 1.1, 0, -.1.9,.05,.05.33,.33,.33

More information

Overview. By end of the week:

Overview. By end of the week: Overview By end of the week: - Know the basics of git - Make sure we can all compile and run a C++/ OpenGL program - Understand the OpenGL rendering pipeline - Understand how matrices are used for geometric

More information

OpenGL BOF Siggraph 2011

OpenGL BOF Siggraph 2011 OpenGL BOF Siggraph 2011 OpenGL BOF Agenda OpenGL 4 update Barthold Lichtenbelt, NVIDIA OpenGL Shading Language Hints/Kinks Bill Licea-Kane, AMD Ecosystem update Jon Leech, Khronos Viewperf 12, a new beginning

More information

Mali & OpenGL ES 3.0. Dave Shreiner Jon Kirkham ARM. Game Developers Conference 27 March 2013

Mali & OpenGL ES 3.0. Dave Shreiner Jon Kirkham ARM. Game Developers Conference 27 March 2013 Mali & OpenGL ES 3.0 Dave Shreiner Jon Kirkham ARM Game Developers Conference 27 March 2013 1 Agenda Some foundational work Instanced geometry rendering Transform feedback Occlusion Queries 2 What s New

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

Mobile Application Programing: Android. OpenGL Operation

Mobile Application Programing: Android. OpenGL Operation Mobile Application Programing: Android OpenGL Operation Activities Apps are composed of activities Activities are self-contained tasks made up of one screen-full of information Activities start one another

More information

Introduction to Shaders.

Introduction to Shaders. Introduction to Shaders Marco Benvegnù hiforce@gmx.it www.benve.org Summer 2005 Overview Rendering pipeline Shaders concepts Shading Languages Shading Tools Effects showcase Setup of a Shader in OpenGL

More information

Dave Shreiner, ARM March 2009

Dave Shreiner, ARM March 2009 4 th Annual Dave Shreiner, ARM March 2009 Copyright Khronos Group, 2009 - Page 1 Motivation - What s OpenGL ES, and what can it do for me? Overview - Lingo decoder - Overview of the OpenGL ES Pipeline

More information

Lecture 19: OpenGL Texture Mapping. CITS3003 Graphics & Animation

Lecture 19: OpenGL Texture Mapping. CITS3003 Graphics & Animation Lecture 19: OpenGL Texture Mapping CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Introduce the OpenGL texture functions and options

More information

Starting out with OpenGL ES 3.0. Jon Kirkham, Senior Software Engineer, ARM

Starting out with OpenGL ES 3.0. Jon Kirkham, Senior Software Engineer, ARM Starting out with OpenGL ES 3.0 Jon Kirkham, Senior Software Engineer, ARM Agenda Some foundational work Instanced geometry rendering Uniform Buffers Transform feedback ETC2 Texture formats Occlusion Queries

More information

CS452/552; EE465/505. Image Formation

CS452/552; EE465/505. Image Formation CS452/552; EE465/505 Image Formation 1-15-15 Outline! Image Formation! Introduction to WebGL, continued Draw a colored triangle using WebGL Read: Angel, Chapters 2 & 3 Homework #1 will be available on

More information

The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)!

The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)! ! The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)! Gordon Wetzstein! Stanford University! EE 267 Virtual Reality! Lecture 4! stanford.edu/class/ee267/! Lecture Overview! Review

More information

Advanced Graphics. OpenGL and Shaders I. Alex Benton, University of Cambridge Supported in part by Google UK, Ltd

Advanced Graphics. OpenGL and Shaders I. Alex Benton, University of Cambridge Supported in part by Google UK, Ltd Advanced Graphics OpenGL and Shaders I 1 Alex Benton, University of Cambridge A.Benton@damtp.cam.ac.uk Supported in part by Google UK, Ltd 3D technologies today Java OpenGL Common, re-usable language;

More information

Computer graphics 2: Graduate seminar in computational aesthetics

Computer graphics 2: Graduate seminar in computational aesthetics Computer graphics 2: Graduate seminar in computational aesthetics Angus Forbes evl.uic.edu/creativecoding/cs526 Homework 2 RJ ongoing... - Follow the suggestions in the Research Journal handout and find

More information

Supplement to Lecture 22

Supplement to Lecture 22 Supplement to Lecture 22 Programmable GPUs Programmable Pipelines Introduce programmable pipelines - Vertex shaders - Fragment shaders Introduce shading languages - Needed to describe shaders - RenderMan

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

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

Shadows. Prof. George Wolberg Dept. of Computer Science City College of New York Shadows Prof. George Wolberg Dept. of Computer Science City College of New York Objectives Introduce Shadow Algorithms Expand to projective textures 2 Flashlight in the Eye Graphics When do we not see

More information

2D graphics with WebGL

2D graphics with WebGL 2D graphics with WebGL Some material contained here is adapted from the book s slides. September 7, 2015 (Dr. Mihail) 2D graphics September 7, 2015 1 / 22 Graphics Pipeline (Dr. Mihail) 2D graphics September

More information

Building Models. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Building Models. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Building Models CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1 Objectives Introduce simple data structures for building polygonal models - Vertex lists - Edge

More information

Introduction to Computer Graphics. Hardware Acceleration Review

Introduction to Computer Graphics. Hardware Acceleration Review Introduction to Computer Graphics Hardware Acceleration Review OpenGL Project Setup Create a command-line style project in Xcode 4 Select the project file and click Build Phases tab Add OpenGL.framework

More information

The Graphics Pipeline

The Graphics Pipeline The Graphics Pipeline Ray Tracing: Why Slow? Basic ray tracing: 1 ray/pixel Ray Tracing: Why Slow? Basic ray tracing: 1 ray/pixel But you really want shadows, reflections, global illumination, antialiasing

More information

CS770/870 Spring 2017 Open GL Shader Language GLSL

CS770/870 Spring 2017 Open GL Shader Language GLSL Preview CS770/870 Spring 2017 Open GL Shader Language GLSL Review traditional graphics pipeline CPU/GPU mixed pipeline issues Shaders GLSL graphics pipeline Based on material from Angel and Shreiner, Interactive

More information

CS770/870 Spring 2017 Open GL Shader Language GLSL

CS770/870 Spring 2017 Open GL Shader Language GLSL CS770/870 Spring 2017 Open GL Shader Language GLSL Based on material from Angel and Shreiner, Interactive Computer Graphics, 6 th Edition, Addison-Wesley, 2011 Bailey and Cunningham, Graphics Shaders 2

More information

Programming with OpenGL Complete Programs Objectives Build a complete first program

Programming with OpenGL Complete Programs Objectives Build a complete first program Programming with OpenGL Complete Programs Objectives Build a complete first program Introduce shaders Introduce a standard program structure Simple viewing Two-dimensional viewing as a special case of

More information

Mobile Application Programming: Android. OpenGL Operation

Mobile Application Programming: Android. OpenGL Operation Mobile Application Programming: Android OpenGL Operation OpenGL ES C-Based Performance-Oriented Graphics Library Wrapper libraries provided for Java, C#, etc. Produces 2D images from 2D or 3D geometric

More information

Programming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico

Programming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico Programming with OpenGL Shaders I Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico 0 Objectives Shader Basics Simple Shaders Vertex shader Fragment shaders 1 Vertex

More information

Introduction to OpenGL/GLSL and WebGL GLSL

Introduction to OpenGL/GLSL and WebGL GLSL Introduction to OpenGL/GLSL and WebGL GLSL Objectives! Give you an overview of the software that you will be using this semester! OpenGL, WebGL, and GLSL! What are they?! How do you use them?! What does

More information

Ciril Bohak. - INTRODUCTION TO WEBGL

Ciril Bohak. - INTRODUCTION TO WEBGL 2016 Ciril Bohak ciril.bohak@fri.uni-lj.si - INTRODUCTION TO WEBGL What is WebGL? WebGL (Web Graphics Library) is an implementation of OpenGL interface for cmmunication with graphical hardware, intended

More information

Today. Rendering - III. Outline. Texturing: The 10,000m View. Texture Coordinates. Specifying Texture Coordinates in GL

Today. Rendering - III. Outline. Texturing: The 10,000m View. Texture Coordinates. Specifying Texture Coordinates in GL Today Rendering - III CS148, Summer 2010 Graphics Pipeline and Programmable Shaders Artist Workflow Siddhartha Chaudhuri 1 2 Outline Texturing: The 10,000m View Intro to textures The fixed-function graphics

More information

OUTLINE. Implementing Texturing What Can Go Wrong and How to Fix It Mipmapping Filtering Perspective Correction

OUTLINE. Implementing Texturing What Can Go Wrong and How to Fix It Mipmapping Filtering Perspective Correction TEXTURE MAPPING 1 OUTLINE Implementing Texturing What Can Go Wrong and How to Fix It Mipmapping Filtering Perspective Correction 2 BASIC STRAGEGY Three steps to applying a texture 1. specify the texture

More information

Programmable GPUs. Real Time Graphics 11/13/2013. Nalu 2004 (NVIDIA Corporation) GeForce 6. Virtua Fighter 1995 (SEGA Corporation) NV1

Programmable GPUs. Real Time Graphics 11/13/2013. Nalu 2004 (NVIDIA Corporation) GeForce 6. Virtua Fighter 1995 (SEGA Corporation) NV1 Programmable GPUs Real Time Graphics Virtua Fighter 1995 (SEGA Corporation) NV1 Dead or Alive 3 2001 (Tecmo Corporation) Xbox (NV2A) Nalu 2004 (NVIDIA Corporation) GeForce 6 Human Head 2006 (NVIDIA Corporation)

More information

CS4621/5621 Fall Basics of OpenGL/GLSL Textures Basics

CS4621/5621 Fall Basics of OpenGL/GLSL Textures Basics CS4621/5621 Fall 2015 Basics of OpenGL/GLSL Textures Basics Professor: Kavita Bala Instructor: Nicolas Savva with slides from Balazs Kovacs, Eston Schweickart, Daniel Schroeder, Jiang Huang and Pramook

More information

Grafica Computazionale: Lezione 30. Grafica Computazionale. Hiding complexity... ;) Introduction to OpenGL. lezione30 Introduction to OpenGL

Grafica Computazionale: Lezione 30. Grafica Computazionale. Hiding complexity... ;) Introduction to OpenGL. lezione30 Introduction to OpenGL Grafica Computazionale: Lezione 30 Grafica Computazionale lezione30 Introduction to OpenGL Informatica e Automazione, "Roma Tre" May 20, 2010 OpenGL Shading Language Introduction to OpenGL OpenGL (Open

More information

SHADER PROGRAMMING. Based on Jian Huang s lecture on Shader Programming

SHADER PROGRAMMING. Based on Jian Huang s lecture on Shader Programming SHADER PROGRAMMING Based on Jian Huang s lecture on Shader Programming What OpenGL 15 years ago could do http://www.neilturner.me.uk/shots/opengl-big.jpg What OpenGL can do now What s Changed? 15 years

More information

CS450/550. Pipeline Architecture. Adapted From: Angel and Shreiner: Interactive Computer Graphics6E Addison-Wesley 2012

CS450/550. Pipeline Architecture. Adapted From: Angel and Shreiner: Interactive Computer Graphics6E Addison-Wesley 2012 CS450/550 Pipeline Architecture Adapted From: Angel and Shreiner: Interactive Computer Graphics6E Addison-Wesley 2012 0 Objectives Learn the basic components of a graphics system Introduce the OpenGL pipeline

More information

Converts geometric primitives into images Is split into several independent stages Those are usually executed concurrently

Converts geometric primitives into images Is split into several independent stages Those are usually executed concurrently Rendering Pipeline Rendering Pipeline Converts geometric primitives into images Is split into several independent stages Those are usually executed concurrently Pipeline 18.10.2013 Steiner- Wallner- Podaras

More information

Advanced Graphics. OpenGL and Shaders I. Alex Benton, University of Cambridge Supported in part by Google UK, Ltd

Advanced Graphics. OpenGL and Shaders I. Alex Benton, University of Cambridge Supported in part by Google UK, Ltd Advanced Graphics OpenGL and Shaders I 1 Alex Benton, University of Cambridge A.Benton@damtp.cam.ac.uk Supported in part by Google UK, Ltd 3D technologies today Java OpenGL Common, re-usable language;

More information

GLSL: Creating GLSL Programs - Overview

GLSL: Creating GLSL Programs - Overview GLSL: Creating GLSL Programs - Overview The steps used to incorporate shaders into an OpenGL program: 1. Create shader programs There must be at least a vertex and a fragment shader Each is a set of strings

More information

The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)!

The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)! ! The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)! Gordon Wetzstein! Stanford University! EE 267 Virtual Reality! Lecture 4! stanford.edu/class/ee267/! Updates! for 24h lab access:

More information

Shader Programs. Lecture 30 Subsections 2.8.2, Robb T. Koether. Hampden-Sydney College. Wed, Nov 16, 2011

Shader Programs. Lecture 30 Subsections 2.8.2, Robb T. Koether. Hampden-Sydney College. Wed, Nov 16, 2011 Shader Programs Lecture 30 Subsections 2.8.2, 2.8.3 Robb T. Koether Hampden-Sydney College Wed, Nov 16, 2011 Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, 2011 1 / 43 Outline 1

More information

Today s Agenda. Shaders fundamentals. Programming with shader-based OpenGL

Today s Agenda. Shaders fundamentals. Programming with shader-based OpenGL Today s Agenda Shaders fundamentals Programming with shader-based OpenGL Shaders Like a function call data are passed in, processed, and passed back out -- Shreiner et al, OpenGL Programming Guide GLSL

More information

last time put back pipeline figure today will be very codey OpenGL API library of routines to control graphics calls to compile and load shaders

last time put back pipeline figure today will be very codey OpenGL API library of routines to control graphics calls to compile and load shaders last time put back pipeline figure today will be very codey OpenGL API library of routines to control graphics calls to compile and load shaders calls to load vertex data to vertex buffers calls to load

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

The Transition from RenderMan to the OpenGL Shading Language (GLSL)

The Transition from RenderMan to the OpenGL Shading Language (GLSL) 1 The Transition from RenderMan to the OpenGL Shading Language (GLSL) Mike Bailey mjb@cs.oregonstate.edu This work is licensed under a Creative Commons Attribution-NonCommercial- NoDerivatives 4.0 International

More information

Introduction to Computer Graphics with WebGL

Introduction to Computer Graphics with WebGL Introduction to Computer Graphics with WebGL Ed Angel The Mandelbrot Set Fractals Fractal (fractional geometry) objects generate some of the most complex and beautiful graphics - The mathematics describing

More information

The Projection Matrix

The Projection Matrix The Projection Matrix Lecture 8 Robb T. Koether Hampden-Sydney College Fri, Sep 11, 2015 Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, 2015 1 / 43 Outline 1 Coordinate Systems

More information

Achieving High-performance Graphics on Mobile With the Vulkan API

Achieving High-performance Graphics on Mobile With the Vulkan API Achieving High-performance Graphics on Mobile With the Vulkan API Marius Bjørge Graphics Research Engineer GDC 2016 Agenda Overview Command Buffers Synchronization Memory Shaders and Pipelines Descriptor

More information

Comp 410/510 Computer Graphics Spring Programming with OpenGL Part 3: Shaders

Comp 410/510 Computer Graphics Spring Programming with OpenGL Part 3: Shaders Comp 410/510 Computer Graphics Spring 2018 Programming with OpenGL Part 3: Shaders Objectives Basic shaders - Vertex shader - Fragment shader Programming shaders with GLSL Finish first program void init(void)

More information

EECS 487: Interactive Computer Graphics

EECS 487: Interactive Computer Graphics Integrating GLSL with OpenGL EECS 487: Interactive Computer Graphics Lecture 19: Integrating shaders with OpenGL program Vertex-array objects with shaders Miscellaneous shader related stuff Integrating

More information

Mining the Rendering Power in Web Browsers. Jianxia Xue Jan. 28, 2014

Mining the Rendering Power in Web Browsers. Jianxia Xue Jan. 28, 2014 Mining the Rendering Power in Web Browsers Jianxia Xue Jan. 28, 2014 Outline Web application as software deployment platform WebGL: Graphics API inside browsers Explore browser rendering capability through

More information

Practical 1: OpenTK Tutorial

Practical 1: OpenTK Tutorial The assignment: 2017/2018, 4th quarter INFOGR: Graphics Practical 1: OpenTK Tutorial Author: Jacco Bikker Based on the (now ancient) 2015 XNA tutorial. The purpose of this assignment is to do a tutorial

More information

WebGL: Hands On. DevCon5 NYC Kenneth Russell Software Engineer, Google, Inc. Chair, WebGL Working Group

WebGL: Hands On. DevCon5 NYC Kenneth Russell Software Engineer, Google, Inc. Chair, WebGL Working Group WebGL: Hands On DevCon5 NYC 2011 Kenneth Russell Software Engineer, Google, Inc. Chair, WebGL Working Group Today's Agenda Introduce WebGL and its programming model. Show code for a complete example. Demonstrate

More information

INTRODUCTION TO OPENGL PIPELINE

INTRODUCTION TO OPENGL PIPELINE CS580: Computer Graphics Min H. Kim KAIST School of Computing Foundations of Computer Graphics INTRODUCTION TO OPENGL PIPELINE 2 1 What is OpenGL? OpenGL = Open Graphics Library An open industry-standard

More information

OpenGL SC. March Sean Harmer Managing Director UK

OpenGL SC. March Sean Harmer Managing Director UK March 2017 OpenGL SC Sean Harmer Managing Director UK The need for safety-critical systems with user-friendly interfaces is on the rise. To respond to this need, the Khronos Group (responsible for OpenGL,

More information

Programming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico

Programming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico Programming with OpenGL Shaders I Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico Objectives Shader Programming Basics Simple Shaders Vertex shader Fragment shaders

More information

CSE 167: Introduction to Computer Graphics Lecture #7: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016

CSE 167: Introduction to Computer Graphics Lecture #7: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016 CSE 167: Introduction to Computer Graphics Lecture #7: GLSL Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016 Announcements Project 2 due Friday 4/22 at 2pm Midterm #1 on

More information

OpenGL shaders and programming models that provide object persistence

OpenGL shaders and programming models that provide object persistence OpenGL shaders and programming models that provide object persistence COSC342 Lecture 22 19 May 2016 OpenGL shaders We discussed forms of local illumination in the ray tracing lectures. We also saw that

More information

From system point of view, a graphics application handles the user input, changes the internal state, called the virtual world by modeling or

From system point of view, a graphics application handles the user input, changes the internal state, called the virtual world by modeling or From system point of view, a graphics application handles the user input, changes the internal state, called the virtual world by modeling or animating it, and then immediately renders the updated model

More information

Tutorial 04. Harshavardhan Kode. September 14, 2015

Tutorial 04. Harshavardhan Kode. September 14, 2015 Tutorial 04 Harshavardhan Kode September 14, 2015 1 About This tutorial an extension of the Tutorial 03. So you might see quite a lot similarities. The following things are new. A Plane is added underneath

More information

Shaders CSCI 4239/5239 Advanced Computer Graphics Spring 2014

Shaders CSCI 4239/5239 Advanced Computer Graphics Spring 2014 Shaders CSCI 4239/5239 Advanced Computer Graphics Spring 2014 What is a Shader? Wikipedia: A shader is a computer program used in 3D computer graphics to determine the final surface properties of an object

More information

Blis: Better Language for Image Stuff Project Proposal Programming Languages and Translators, Spring 2017

Blis: Better Language for Image Stuff Project Proposal Programming Languages and Translators, Spring 2017 Blis: Better Language for Image Stuff Project Proposal Programming Languages and Translators, Spring 2017 Abbott, Connor (cwa2112) Pan, Wendy (wp2213) Qinami, Klint (kq2129) Vaccaro, Jason (jhv2111) [System

More information

Best practices for effective OpenGL programming. Dan Omachi OpenGL Development Engineer

Best practices for effective OpenGL programming. Dan Omachi OpenGL Development Engineer Best practices for effective OpenGL programming Dan Omachi OpenGL Development Engineer 2 What Is OpenGL? 3 OpenGL is a software interface to graphics hardware - OpenGL Specification 4 GPU accelerates rendering

More information

The Basic Computer Graphics Pipeline, OpenGL-style. Introduction to the OpenGL Shading Language (GLSL)

The Basic Computer Graphics Pipeline, OpenGL-style. Introduction to the OpenGL Shading Language (GLSL) Introduction to the OpenGL Shading Language (GLSL) 1 The Basic Pipeline, OpenGL-style Vertex, Normal, Color ModelViewMatrix, ProjectionMatrix, ModelViewProjectionMatrix 2 MC Model WC View Per-vertex Projection

More information

CMPS160 Shader-based OpenGL Programming. All slides originally from Prabath Gunawardane, et al. unless noted otherwise

CMPS160 Shader-based OpenGL Programming. All slides originally from Prabath Gunawardane, et al. unless noted otherwise CMPS160 Shader-based OpenGL Programming All slides originally from Prabath Gunawardane, et al. unless noted otherwise Shader gallery I Above: Demo of Microsoft s XNA game platform Right: Product demos

More information

Fog example. Fog is atmospheric effect. Better realism, helps determine distances

Fog example. Fog is atmospheric effect. Better realism, helps determine distances Fog example Fog is atmospheric effect Better realism, helps determine distances Fog Fog was part of OpenGL fixed function pipeline Programming fixed function fog Parameters: Choose fog color, fog model

More information

Introduction to the OpenGL Shading Language (GLSL)

Introduction to the OpenGL Shading Language (GLSL) 1 Introduction to the OpenGL Shading Language (GLSL) This work is licensed under a Creative Commons Attribution-NonCommercial- NoDerivatives 4.0 International License Mike Bailey mjb@cs.oregonstate.edu

More information

The Projection Matrix

The Projection Matrix The Projection Matrix Lecture 5 Robb T. Koether Hampden-Sydney College Wed, Aug 30, 2017 Robb T. Koether (Hampden-Sydney College) The Projection Matrix Wed, Aug 30, 2017 1 / 21 Outline 1 The World Coordinate

More information

PROFESSIONAL. WebGL Programming DEVELOPING 3D GRAPHICS FOR THE WEB. Andreas Anyuru WILEY. John Wiley & Sons, Ltd.

PROFESSIONAL. WebGL Programming DEVELOPING 3D GRAPHICS FOR THE WEB. Andreas Anyuru WILEY. John Wiley & Sons, Ltd. PROFESSIONAL WebGL Programming DEVELOPING 3D GRAPHICS FOR THE WEB Andreas Anyuru WILEY John Wiley & Sons, Ltd. INTRODUCTION xxl CHAPTER 1: INTRODUCING WEBGL 1 The Basics of WebGL 1 So Why Is WebGL So Great?

More information