CS 4363/6353 OPENGL BACKGROUND. WHY IS THIS CLASS SO HARD TO TEACH? (I’LL STOP WHINING SOON) Hardware (GPUs) double in processing power ever 6 months!

Slides:



Advertisements
Similar presentations
Programming with OpenGL - Getting started - Hanyang University Han Jae-Hyek.
Advertisements

COMPUTER GRAPHICS SOFTWARE.
©Zachary Wartell, UNCC9/28/ :30 AM 1 Overview of OpenGL Revision: 1.2 Copyright Professor Zachary Wartell, University of North Carolina All Rights.
Chapter 2: Graphics Programming
Graphics Pipeline.
CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
Basics. OpenGL. “Hello world” George Georgiev Telerik Corporation
A Crash Course on Programmable Graphics Hardware Li-Yi Wei 2005 at Tsinghua University, Beijing.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Programming with OpenGL Part 1: Background Ed Angel Professor of Computer Science, Electrical.
OpenGL Help Session CS248 Fall 2006 Zhengyun Zhang.
GPU Simulator Victor Moya. Summary Rendering pipeline for 3D graphics. Rendering pipeline for 3D graphics. Graphic Processors. Graphic Processors. GPU.
Programming with OpenGL Part 1: Background Mohan Sridharan Based on slides created by Edward Angel CS4395: Computer Graphics 1.
Open Graphics Library (OpenGL)
GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware.
CAP4730: Computational Structures in Computer Graphics Introduction to OpenGL.
CS 480/680 Computer Graphics Course Overview Dr. Frederick C Harris, Jr. Fall 2012.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Basic OpenGL Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, September 10, 2003.
Using OpenGL. 2 What is OpenGL? A software interface to graphics hardware It is a Graphics Rendering API (Application Programmer’s Interface) that is.
Linear Interpolation, Brief Introduction to OpenGL Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, September.
OpenGL Shading Language (Advanced Computer Graphics) Ernest Tatum.
CSC 461: Lecture 41 CSC461: Lecture 4 Introduction to OpenGL Objectives: Development of the OpenGL API OpenGL Architecture -- OpenGL as a state machine.
Graphics Architectures & OpenGL API Introduction Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
CS 480/680 Computer Graphics Programming with Open GL Part 1: Background Dr. Frederick C Harris, Jr. Fall 2011.
Computer Graphics Tz-Huan Huang National Taiwan University.
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,
2 COEN Computer Graphics I Introductions n Brad Grantham lecturer lab dude n Dave Shreiner lecturer slave driver.
Programming with OpenGL Part 1: Background
1. OpenGL/GLU/GLUT  OpenGL v4.0 (latest) is the “core” library that is platform independent  GLUT v3.7 is an auxiliary library that handles window creation,
Real-Time High Quality Rendering CSE 291 [Winter 2015], Lecture 4 Brief Intro to Programmable Shaders
OpenGL-ES 3.0 And Beyond Boston What is EGL? EGL handles: –provides available surface specifications –context management –surface binding –render.
CS 480/680 Intro Dr. Frederick C Harris, Jr. Fall 2014.
Introduction to OpenGL Programming Jian-Liang Lin 2002.
GRAPHICS PIPELINE & SHADERS SET09115 Intro to Graphics Programming.
CS662 Computer Graphics Game Technologies Jim X. Chen, Ph.D. Computer Science Department George Mason University.
Review of OpenGL Basics
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Programming with OpenGL Part 1: Background Ed Angel Professor Emeritus.
CPSC 453 Tutorial Xin Liu Sep 23, OpenGL An open standard of rendering pipeline A software interface to graphics hardware A useful set of APIs for.
Introduction to OpenGL  OpenGL is a graphics API  Software library  Layer between programmer and graphics hardware (and software)  OpenGL can fit in.
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.
Chun-Yuan Lin Introduction to OpenGL 2015/12/19 1 CG.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Lecture 2: Introduction to OpenGL
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.
An Introduction to the Cg Shading Language Marco Leon Brandeis University Computer Science Department.
GLSL Review Monday, Nov OpenGL pipeline Command Stream Vertex Processing Geometry processing Rasterization Fragment processing Fragment Ops/Blending.
Introduction to OpenGL (INF 250) Veronika Solteszova et al., UiB Dept. of Informatics,
OpenGL CS418 Computer Graphics John C. Hart. OpenGL Based on GL (graphics library) by Silicon Graphics Inc. (SGI) Advantages: Runs on everything, including.
COMP 175 | COMPUTER GRAPHICS Remco Chang1/XX13 – GLSL Lecture 13: OpenGL Shading Language (GLSL) COMP 175: Computer Graphics April 12, 2016.
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
Programming with OpenGL Part 1: Background
Computer Graphics Lecture 32
A Crash Course on Programmable Graphics Hardware
Graphics Processing Unit
Introduction to OpenGL
Chapter 6 GPU, Shaders, and Shading Languages
CS451Real-time Rendering Pipeline
Introduction to Computer Graphics with WebGL
Graphics Processing Unit
Programming with OpenGL Part 1: Background
Programming with OpenGL Part 1: Background
Programming with OpenGL Part 1: Background
Mickaël Sereno Shaders Mickaël Sereno 25/04/2019 Mickaël Sereno -
CIS 441/541: Introduction to Computer Graphics Lecture 15: shaders
Introduction to OpenGL
OpenGL Background CS 4722.
OpenGL-Rendering Pipeline
CS 480/680 Fall 2011 Dr. Frederick C Harris, Jr. Computer Graphics
Presentation transcript:

CS 4363/6353 OPENGL BACKGROUND

WHY IS THIS CLASS SO HARD TO TEACH? (I’LL STOP WHINING SOON) Hardware (GPUs) double in processing power ever 6 months! The “graphics pipeline” has been *drastically* changing Core profile Compatibility profile (for backwards compatibility) More of the pipeline is available: Good for developers (beautiful graphics) Hard for teachers (more difficult to get a “Hello, World!” going) Requires students to understand more simply to begin Need scaffolding

WHAT IS OPENGL? “Open” (source) Graphics Language Developed by Silicon Graphics, Inc. (SGI) Not a language, but an API (Application Programming Interface) Include the “new” GLSL (Shading Language) – a C-like language for rendering Intended to run on hardware Cross-platform (MacOS, Windows, Linux using Mesa3D) Was “owned” by an industry board (the ARB – Architecture Review Board) and now the Khronos group OpenGL != GPGPU Mesa is an open-source software implementation

VERSIONS V1 – Fixed function pipeline 1992 – – – – – 1.5 V2 – Programmable pipeline 2004 – V3* – Programmable buffers 2008 – – – – 3.3 V4 - ?? 2010 – (Aug) – 4.2 * No longer backwards compatible

STATE MACHINE OpenGL is a state machine that uses a client/server model Our (C/C++) program is the client The hardware (GPU driver) is the server Client sends commands to the server This is what GLEW does – asks the driver for pointers to all the gl functions!

HELPER LIBRARIES YOU MIGHT USE GL – The Graphics Library (opengl32.lib and DLL) GLUT – OpenGL “Utility Toolkit” for system-independent windows, which also accepts user input (mouse). Others are: SDL GLX WGL We’ll use “FreeGLUT” GLEW – The GL “Extension Wrangler” for determining which vendor extensions are available and loading them (later

GL CONVENTIONS Functions can begin with gl or glut Data types usually begin with GL GLboolean -1 bit GLbyte – 8 bits GLubyte – 8 bits (unsigned) GLchar – 8 bits GLshort - 16 bits GLushort – 16 bits unsigned GLint – 32 bits GLuint – 32 bits unsigned Enumerants start with GL_ GL_TRIANGLES GLsizei – 32 bits GLenum – 32 bits GLfloat – 32 bits GLdouble – 64 bits GLint64 – 64 bits GLintptr – native pointer

OPENGL ERRORS Hard to debug! Use the built-in method to determine which error occurred: GL_INVALID_ENUM GL_INVALID_VALUE GL_INVALID_OPERATION GL_OUT_OF_MEMORY GL_NO_ERROR if (glGetError() == GL_INVALID_OPERATION) {...} Note: invalid function calls are quietly disregarded!

IDENTIFYING THE VERSION Can query for the vendor and version number of the rendering engine: const GLubyte* glGetString(GLenum name);

HINTS… Sometimes, you need speed at the sacrifice of quality. glHint (GLenum target, GLenum mode) Sometimes, you need speed at the sacrifice of quality. glHint (GL_POLYGON_SMOOTH, GL_FASTEST);

ARE YOU AN ENABLER? (MORE OF THE STATE MACHINE) In OpenGL, we are always turning features on and off with glEnable and glDisable By default, everything is disabled! Example: glEnable (GL_DEPTH_TEST);. glDisable (GL_DEPTH_TEST); Note: you can always determine if something is on with GLboolean glIsEnabled(GLenum);

COLOR THEORY All colors in OpenGL are comprised of three primary colors Red Green Blue Have two separate ranges Examples: Red = {255, 0, 0} Green = {0, 255, 0} Blue = {0, 0, 255}

LIGHTING Lighting is complex! We have to make approximations to real-world lighting For now, understand OpenGL supports the idea of: Camera (View) – using a matrix Light sources – using an array Normals of a triangle We use math to calculate light

THE GRAPHICS PIPELINE (AKA - THE BIG PICTURE) Vertex Processing Clipping/Assembly Rasterization Fragment Processing 4 major phases, though several sub-phases

THE GRAPHICS PIPELINE (AKA - THE BIG PICTURE) Vertex Processing Clipping/Assembly Rasterization Fragment Processing Vertex Processing Transform vertices using math Light a vertex Determine the color of a vertex We write vertex shaders to do this!

THE GRAPHICS PIPELINE (AKA - THE BIG PICTURE) Vertex Processing Clipping/Assembly Rasterization Fragment Processing Clipping and Primitive Assembly Assemble vertices into triangles Clip triangles if they straddle viewport We have no (programmable) control over this

THE GRAPHICS PIPELINE (AKA - THE BIG PICTURE) Vertex Processing Clipping/Assembly Rasterization Fragment Processing Rasterization “Scanline” converting Output is a set of “uncolored” fragments Not programmable

THE GRAPHICS PIPELINE (AKA - THE BIG PICTURE) Vertex Processing Clipping/Assembly Rasterization Fragment Processing Works on a pixel/fragment basis Determining the color of each pixel We write pixel shaders for this Lighting Materials Color information