OpenGL Background CS 4722.

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.
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.
Introduction to OpenGL. What is OpenGL OpenGL is a low-level software interface to graphics hardware No commands for performing windowing tasks or obtaining.
Programming with OpenGL Part 1: Background Mohan Sridharan Based on slides created by Edward Angel CS4395: Computer Graphics 1.
Open Graphics Library (OpenGL)
CAP4730: Computational Structures in Computer Graphics Introduction to OpenGL.
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.
OpenGL Shading Language (Advanced Computer Graphics) Ernest Tatum.
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
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,
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!
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.
Graphics: Conceptual Model
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.
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.
Hank Childs, University of Oregon Oct. 28th, 2016 CIS 441/541: Introduction to Computer Graphics Lecture 16: textures.
Programming with OpenGL Part 1: Background
Shader.
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
Understanding Theory and application of 3D
Introduction to Computer Graphics with WebGL
Graphics Processing Unit
Programming with OpenGL Part 1: Background
CS5500 Computer Graphics April 17, 2006 CS5500 Computer Graphics
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-Rendering Pipeline
CS 480/680 Fall 2011 Dr. Frederick C Harris, Jr. Computer Graphics
Presentation transcript:

OpenGL Background CS 4722

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 * No longer backwards compatible V1 – Fixed function pipeline 1992 – 1.0 1997 – 1.1 1998 - 1.2 2001 – 1.3 2002 – 1.4 2003 – 1.5 V2 – Programmable pipeline 2004 – 2.0 2006 - 2. V3* – Programmable buffers 2008 – 3.0 2009 – 3.1 2009 – 3.2 2010 – 3.3 V4 - ?? 2010 – 4.0 2011 (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) 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 0-255 0.0-1.0 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 4 major phases, though several sub-phases Clipping/Assembly Rasterization Fragment Processing

the Graphics Pipeline (AKA - the Big Picture) Vertex Processing Vertex Processing Transform vertices using math Light a vertex Determine the color of a vertex We write vertex shaders to do this! Clipping/Assembly Rasterization Fragment Processing

the Graphics Pipeline (AKA - the Big Picture) Vertex Processing Clipping and Primitive Assembly Assemble vertices into triangles Clip triangles if they straddle viewport We have no (programmable) control over this Clipping/Assembly Rasterization Fragment Processing

the Graphics Pipeline (AKA - the Big Picture) Vertex Processing Rasterization “Scanline” converting Output is a set of “uncolored” fragments Not programmable Clipping/Assembly Rasterization Fragment Processing

the Graphics Pipeline (AKA - the Big Picture) Vertex Processing Fragment Processing Works on a pixel/fragment basis Determining the color of each pixel We write pixel shaders for this Lighting Materials Color information Clipping/Assembly Rasterization Fragment Processing