Introduction to OpenGL

Slides:



Advertisements
Similar presentations
COMPUTER GRAPHICS SOFTWARE.
Advertisements

COMPUTER GRAPHICS CS 482 – FALL 2014 NOVEMBER 10, 2014 GRAPHICS HARDWARE GRAPHICS PROCESSING UNITS PARALLELISM.
Graphics Pipeline.
 The success of GL lead to OpenGL (1992), a platform-independent API that was  Easy to use  Close enough to the hardware to get excellent performance.
Introduction to Geometry Shaders Patrick Cozzi Analytical Graphics, Inc.
OpenGL and WebGL Drawing Functions CSCI 440 Day Five.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Course Overview, Introduction to CG Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, September 5, 2003.
CS 480/680 Computer Graphics Course Overview Dr. Frederick C Harris, Jr. Fall 2012.
What is ? Open Graphics Library A cross-language, multi-platform API for rendering 2D and 3D computer graphics. The API is used to interact with a Graphics.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Drawing Basic Graphics Primitives Lecture 4 Wed, Sep 3, 2003.
A Really (too) Short Introduction to OpenGL Peter Rautek.
Programming with OpenGL Part 2: Complete Programs Ed Angel Professor of Emeritus of Computer Science University of New Mexico.
3D API By Clayton Azzopardi (Group 10). Introduction Android uses the OpenGL ES 1.0 API Android uses the OpenGL ES 1.0 API Open Graphics Library for Embedded.
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,
CS 480/680 Intro Dr. Frederick C Harris, Jr. Fall 2014.
به نام خدا تنظیم کننده : فرانه حدادی استاد : مهندس زمانیان تابستان 92.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Graphics CSCI 343, Fall 2015 Lecture 2 Introduction to HTML, JavaScript and WebGL.
COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.
GRAPHICS PIPELINE & SHADERS SET09115 Intro to Graphics Programming.
Introduction to OpenGL  OpenGL is a graphics API  Software library  Layer between programmer and graphics hardware (and software)  OpenGL can fit in.
Computer Graphics Bing-Yu Chen National Taiwan University.
1 3D API OPENGL ES v1.0 Owned by Silicon Graphics (SGL) Control was then transferred to Khronos Group Introduction.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
OpenGL-ES 3.0 And Beyond Boston Photo credit :Johnson Cameraface OpenGL Basics.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Graphics CSCI 343, Fall 2015 Lecture 3 Introduction to WebGL.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 29, 2015 RENDERING RASTERIZATION RAY CASTING PROGRAMMABLE SHADERS.
What are Computer Graphics Basically anything that is on you Monitor – This includes the text that you will see Text isn’t Advanced Graphics But…. Understanding.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Programming with OpenGL Part 4: Color and Attributes Isaac Gang University.
COMP 175 | COMPUTER GRAPHICS Remco Chang1/XX13 – GLSL Lecture 13: OpenGL Shading Language (GLSL) COMP 175: Computer Graphics April 12, 2016.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
Lecture 8: Discussion of papers OpenGL programming Lecturer: Simon Winberg Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
Our Graphics Environment Landscape Rendering. Hardware  CPU  Modern CPUs are multicore processors  User programs can run at the same time as other.
CS 480/680 Computer Graphics Programming with Open GL Part 2: Complete Programs Dr. Frederick C Harris, Jr. Fall 2011.
CS 4722 Made by Dr. Jeffrey Chastine Modified by Dr. Chao Mei
GPU Architecture and Its Application
COMPUTER GRAPHICS CHAPTER 38 CS 482 – Fall 2017 GRAPHICS HARDWARE
ICG Syllabus 1. Introduction 2. Viewing in 3D and Graphics Programming
Week 2 - Friday CS361.
Computer Graphics Lecture 32
School of Computer Science
Graphics Processing Unit
Deferred Lighting.
Introduction to OpenGL
Lecture 18 Fasih ur Rehman
Chapter 6 GPU, Shaders, and Shading Languages
Models and Architectures
Introduction to Computer Graphics with WebGL
Models and Architectures
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Programming with OpenGL Part 4: Color and Attributes
Day 05 Shader Basics.
Chapter VI OpenGL ES and Shader
Introduction to Computer Graphics with WebGL
The Graphics Pipeline Lecture 5 Mon, Sep 3, 2007.
Models and Architectures
Programming with OpenGL Part 4: Color and Attributes
Computer Graphics Introduction to Shaders
CIS 441/541: Introduction to Computer Graphics Lecture 15: shaders
OpenGL-Rendering Pipeline
CIS 6930: Chip Multiprocessor: GPU Architecture and Programming
Presentation transcript:

Introduction to OpenGL CS 480/680 Computer Graphics Introduction to OpenGL

What Is OpenGL? OpenGL is a computer graphics rendering application programming interface, or API (for short) With it, you can generate high-quality color images by rendering with geometric and image primitives It forms the basis of many interactive applications that include 3D graphics By using OpenGL, the graphics part of your application can be operating system independent window system independent

Course Ground Rules We’ll concentrate on the latest versions of OpenGL They enforce a new way to program with OpenGL Allows more efficient use of GPU resources Modern OpenGL doesn’t support many of the “classic” ways of doing things, such as Fixed-function graphics operations, like vertex lighting and transformations All applications must use shaders for their graphics processing we only introduce a subset of OpenGL’s shader capabilities in this course

Evolution of the OpenGL Pipeline

In the Beginning … OpenGL 1.0 was released on July 1st, 1994 Its pipeline was entirely fixed-function the only operations available were fixed by the implementation The pipeline evolved but remained based on fixed-function operation through OpenGL versions 1.1 through 2.0 (Sept. 2004) Primitive Setup and Rasterization Fragment Coloring and Texturing Blending Vertex Data Pixel Data Vertex Transform and Lighting Texture Store

Beginnings of The Programmable Pipeline OpenGL 2.0 (officially) added programmable shaders vertex shading augmented the fixed-function transform and lighting stage fragment shading augmented the fragment coloring stage However, the fixed-function pipeline was still available Primitive Setup and Rasterization Fragment Coloring and Texturing Blending Vertex Data Pixel Data Vertex Transform and Lighting Texture Store

An Evolutionary Change OpenGL 3.0 introduced the deprecation model the method used to remove features from OpenGL The pipeline remained the same until OpenGL 3.1 (released March 24th, 2009) Introduced a change in how OpenGL contexts are used Context Type Description Full Includes all features (including those marked deprecated) available in the current version of OpenGL Forward Compatible Includes all non-deprecated features (i.e., creates a context that would be similar to the next version of OpenGL)

The Exclusively Programmable Pipeline OpenGL 3.1 removed the fixed-function pipeline programs were required to use only shaders Additionally, almost all data is GPU-resident all vertex data sent using buffer objects Primitive Setup and Rasterization Fragment Shader Blending Vertex Data Pixel Data Vertex Shader Texture Store

Setup and Rasterization More Programmability OpenGL 3.2 (released August 3rd, 2009) added an additional shading stage – geometry shaders modify geometric primitives within the graphics pipeline Primitive Setup and Rasterization Fragment Shader Blending Vertex Data Pixel Data Vertex Shader Texture Store Geometry Shader

More Evolution: Context Profiles OpenGL 3.2 also introduced context profiles profiles control which features are exposed it’s like GL_ARB_compatibility, only not insane  currently two types of profiles: core and compatible Context Type Profile Description Full core All features of the current release compatible All features ever in OpenGL Forward Compatible All non-deprecated features Not supported

The Latest Pipelines OpenGL 4.1 (released July 25th, 2010) included additional shading stages – tessellation-control and tessellation-evaluation shaders Latest version is 4.5 (August 2014) Primitive Setup and Rasterization Fragment Shader Blending Vertex Data Pixel Data Vertex Shader Texture Store Geometry Shader Tessellation Control Shader Tessellation Evaluation Shader

OpenGL ES and WebGL OpenGL ES 2.0 WebGL Designed for embedded and hand-held devices such as cell phones Based on OpenGL 3.1 Shader based WebGL JavaScript implementation of ES 2.0 Runs on most recent browsers

OpenGL Application Development

A Simplified Pipeline Model Vertex Processing Rasterizer Fragment Processing Vertex Shader Fragment GPU Data Flow Application Framebuffer Vertices Fragments Pixels

OpenGL Programming in a Nutshell Modern OpenGL programs essentially do the following steps: Create shader programs Create buffer objects and load data into them “Connect” data locations with shader variables Render

Application Framework Requirements OpenGL applications need a place to render into usually an on-screen window Need to communicate with native windowing system Each windowing system interface is different We have a framework that was designed for us……

Simplifying Working with OpenGL Operating systems deal with library functions differently compiler linkage and runtime libraries may expose different functions Additionally, OpenGL has many versions and profiles which expose different sets of functions managing function access is cumbersome, and window-system dependent We use another open-source library, GLEW, to hide those details

Representing Geometric Objects Geometric objects 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 Position stored in 4 dimensional homogeneous coordinates Vertex data must be stored in vertex buffer objects (VBOs) VBOs must be stored in vertex array objects (VAOs)

OpenGL’s Geometric Primitives All primitives are specified by vertices GL_LINE_STRIP GL_LINE_LOOP GL_LINES GL_POINTS To form 3D geometric objects, you need to decompose them into geometric primitives that OpenGL can draw. OpenGL only knows how to draw three things: points, lines, and triangles, but can use collections of the same type of primitive to optimize rendering. GL_TRIANGLE_STRIP GL_TRIANGLES GL_TRIANGLE_FAN OpenGL Primitive Description Total Vertices for n Primitives GL_POINTS Render a single point per vertex (points may be larger than a single pixel) n GL_LINES Connect each pair of vertices with a single line segment. 2n GL_LINE_STRIP Connect each successive vertex to the previous one with a line segment. n+1 GL_LINE_LOOP Connect all vertices in a loop of line segments. GL_TRIANGLES Render a triangle for each triple of vertices. 3n GL_TRIANGLE_STRIP Render a triangle from the first three vertices in the list, and then create a new triangle with the last two rendered vertices, and the new vertex. n+2 GL_TRIANGLE_FAN Create triangles by using the first vertex in the list, and pairs of successive vertices.

OpenGL Pipeline This is the figure I will typically use when illustrating the pipeline. Here is a link to the full pipeline https://www.seas.upenn.edu/~pcozzi/OpenGLInsights/OpenGL44PipelineMap.pdf