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

Similar documents
Why modern versions of OpenGL should be used Some useful API commands and extensions

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT

Real - Time Rendering. Graphics pipeline. Michal Červeňanský Juraj Starinský

Real - Time Rendering. Pipeline optimization. Michal Červeňanský Juraj Starinský

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

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

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS SPRING 2016 DR. MICHAEL J. REALE

OpenGL Programmable Shaders

OpenGL Essentials Training

The Application Stage. The Game Loop, Resource Management and Renderer Design

Drawing Fast The Graphics Pipeline

Rendering Objects. Need to transform all geometry then

Beginning Direct3D Game Programming: 1. The History of Direct3D Graphics

Lecture 2. Shaders, GLSL and GPGPU

Graphics Hardware. Graphics Processing Unit (GPU) is a Subsidiary hardware. With massively multi-threaded many-core. Dedicated to 2D and 3D graphics

CSC Graphics Programming. Budditha Hettige Department of Statistics and Computer Science

Drawing Fast The Graphics Pipeline

Shading Languages. Ari Silvennoinen Apri 12, 2004

Introduction to Shaders.

WebGL (Web Graphics Library) is the new standard for 3D graphics on the Web, designed for rendering 2D graphics and interactive 3D graphics.

20 Years of OpenGL. Kurt Akeley. Copyright Khronos Group, Page 1

Dave Shreiner, ARM March 2009

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

Graphics Pipeline & APIs

Ciril Bohak. - INTRODUCTION TO WEBGL

X. GPU Programming. Jacobs University Visualization and Computer Graphics Lab : Advanced Graphics - Chapter X 1

Spring 2009 Prof. Hyesoon Kim

Programmable Graphics Hardware

CS427 Multicore Architecture and Parallel Computing

Programmable GPUs Outline

GeForce4. John Montrym Henry Moreton

Working with Metal Overview

Mention driver developers in the room. Because of time this will be fairly high level, feel free to come talk to us afterwards

Programming with OpenGL Part 1: Background

Graphics Pipeline & APIs

Graphics Processing Unit Architecture (GPU Arch)

Early History of APIs. PHIGS and X. SGI and GL. Programming with OpenGL Part 1: Background. Objectives

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

Tutorial on GPU Programming #2. Joong-Youn Lee Supercomputing Center, KISTI

Introduction to the OpenGL Shading Language

Direct Rendering of Trimmed NURBS Surfaces

Rasterization Overview

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

Graphics Hardware. Instructor Stephen J. Guy

Getting fancy with texture mapping (Part 2) CS559 Spring Apr 2017

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

CS GPU and GPGPU Programming Lecture 2: Introduction; GPU Architecture 1. Markus Hadwiger, KAUST

1.2.3 The Graphics Hardware Pipeline

GPU Memory Model Overview

Introduction. What s New in This Edition

OpenGL Status - November 2013 G-Truc Creation

E.Order of Operations

The Graphics Pipeline

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside

Lecture 13: OpenGL Shading Language (GLSL)

COMP371 COMPUTER GRAPHICS

Copyright Khronos Group Page 1

OpenGL SUPERBIBLE. Fifth Edition. Comprehensive Tutorial and Reference. Richard S. Wright, Jr. Nicholas Haemel Graham Sellers Benjamin Lipchak

Spring 2011 Prof. Hyesoon Kim

Free Downloads OpenGL ES 3.0 Programming Guide

Shaders. Slide credit to Prof. Zwicker

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

CS452/552; EE465/505. Clipping & Scan Conversion

CHAPTER 1 Graphics Systems and Models 3

Drawing Fast The Graphics Pipeline

Graphics Hardware, Graphics APIs, and Computation on GPUs. Mark Segal

Programming Guide. Aaftab Munshi Dan Ginsburg Dave Shreiner. TT r^addison-wesley

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

Today s Agenda. Basic design of a graphics system. Introduction to OpenGL

PowerVR Hardware. Architecture Overview for Developers

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

CSE 167: Introduction to Computer Graphics Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015

Shaders CSCI 4239/5239 Advanced Computer Graphics Spring 2014

12.2 Programmable Graphics Hardware

CS 354R: Computer Game Technology

Cornell University CS 569: Interactive Computer Graphics. Introduction. Lecture 1. [John C. Stone, UIUC] NASA. University of Calgary

Chapter 1 Introduction

Rationale for Non-Programmable Additions to OpenGL 2.0

Introduction to OpenGL

Shader Series Primer: Fundamentals of the Programmable Pipeline in XNA Game Studio Express

We assume that you are familiar with the following:

CS130 : Computer Graphics. Tamar Shinar Computer Science & Engineering UC Riverside

GPU Memory Model. Adapted from:

MMGD0206 Computer Graphics. Chapter 1 Development of Computer Graphics : History

Rasterization and Graphics Hardware. Not just about fancy 3D! Rendering/Rasterization. The simplest case: Points. When do we care?

3D Computer Games Technology and History. Markus Hadwiger VRVis Research Center

Graphics Performance Optimisation. John Spitzer Director of European Developer Technology

Current Trends in Computer Graphics Hardware

Programming Graphics Hardware

Shaders (some slides taken from David M. course)

Development of Computer Graphics

CS451Real-time Rendering Pipeline

Next Generation OpenGL Neil Trevett Khronos President NVIDIA VP Mobile Copyright Khronos Group Page 1

Graphics Architectures and OpenCL. Michael Doggett Department of Computer Science Lund university

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

CS770/870 Spring 2017 Open GL Shader Language GLSL

CS770/870 Spring 2017 Open GL Shader Language GLSL

Bringing it all together: The challenge in delivering a complete graphics system architecture. Chris Porthouse

Whiz-Bang Graphics and Media Performance for Java Platform, Micro Edition (JavaME)

Transcription:

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 Graphics Library) is a standard specification defining a cross-language, cross-platform API for writing applications that produce 2D and 3D computer graphics The API consists of over 250 different function calls which can be used to draw complex three-dimensional scenes from simple primitives OpenGL was developed by Silicon Graphics Inc (SGI) in 1992 and is widely used in CAD, virtual reality, scientific visualization, information visualization, and flight simulation It is also used in video games, where it competes with Direct3D on Microsoft Windows platforms (see OpenGL vs Direct3D) OpenGL is managed by a non-profit technology consortium, the Khronos Group Hiding complexity... ;) OpenGL serves two main purposes: Hide complexities of interfacing with different 3D accelerators by presenting a single, uniform interface Hide differing capabilities of hardware platforms by requiring support of full OpenGL feature set for all implementations (using software emulation if necessary).

Basic operations OpenGL is a low-level, procedural API OpenGL s basic operation is to accept primitives such as points, lines and polygons, and convert them into pixels This is done by a graphics pipeline known as the OpenGL state machine Most OpenGL commands either issue primitives to the graphics pipeline, or configure how the pipeline processes these primitives (attributes) Prior to the introduction of OpenGL 2.0, each stage of the pipeline performed a fixed function and was configurable only within tight limits OpenGL 2.0 offers several stages that are fully programmable using GLSL. OpenGL is a low-level, procedural API, requiring the programmer to dictate the exact steps required to render a scene This contrasts with descriptive (aka scene graph or retained mode) APIs, where a programmer only needs to describe a scene and can let the library manage the details of rendering it OpenGL s low-level design requires programmers to have a good knowledge of the graphics pipeline, but also gives a certain amount of freedom to implement novel rendering algorithms. Rasterised points, lines and polygons as basic primitives Evaluation OpenGL has historically been influential on the development of 3D accelerators, promoting a base level of functionality that is now common in consumer-level hardware: Simplified version of the Graphics Pipeline Process: Transform and lighting pipeline Z-buffering Texture mapping Alpha blending excludes a number of features like blending, VBOs (Vertex Basic Objects) andlogicops: Evaluation, if necessary, of the polynomial functions which define certain inputs, like NURBS surfaces, approximating curves and the surface geometry.

Vertex operations Rasterisation Vertex operations, transforming and lighting them depending on their material. Also clipping non visible parts of the scene in order to produce the viewing volume Rasterisation or conversion of the previous information into pixels. The polygons are represented by the appropriate colour by means of interpolation algorithms. Per-fragment operations Frame buffer Per-fragment operations, like updating values depending on incoming and previously stored depth values, or colour combinations, among others. Lastly, fragments are inserted into the Frame buffer. A framebuffer is a video output device that drives a video display from a memory buffer containing a complete frame of data.

First example In the 1980s, developing software that could function with a wide range of graphics hardware was a real challenge Software developers wrote custom interfaces and drivers for each piece of hardware This was expensive and resulted in much duplication of effort By the early 1990s, Silicon Graphics (SGI) was a leader in 3D graphics for workstations Their IRIS GL API was considered the state of the art and became the de-facto industry standard, overshadowing the open standards-based PHIGS This was because IRIS GL was considered easier to use, and because it supported immediate mode rendering By contrast, PHIGS was considered difficult to use and outdated in terms of functionality. SGI s competitors (including Sun Microsystems, Hewlett-Packard and IBM) were also able to bring to market 3D hardware, supported by extensions made to the PHIGS standard This in turn caused SGI market share to weaken as more 3D graphics hardware suppliers entered the market In an effort to influence the market, SGI decided to turn the IrisGL API into an open standard Meanwhile, SGI would continue to try to maintain their customers tied to SGI hardware by developing the advanced and proprietary Iris Inventor and Iris Performer programming APIs As a result, SGI released the OpenGL standard 1992 SGI led the creation of the OpenGL architectural review board (OpenGL ARB), the group of companies that would maintain and expand the OpenGL specification 1995 Microsoft released Direct3D, which would become the main competitor of OpenGL. OpenGL 1.0 Released January, 1992. The first OpenGL specification was released by Mark Segal and Kurt Akeley. OpenGL 1.1 Released January, 1997. OpenGL 1.1 focused on supporting textures and texture formats on GPU hardware

OpenGL 1.2 Released March 16, 1998. OpenGL 1.2 focused on supporting volume textures, packed pixels, normal rescaling, clamped/edge texture sampling and image processing. OpenGL 1.2.1 Released October 14, 1998. OpenGL 1.2.1 was a minor release after OpenGL 1.2 (March 16, 1998) which added multi-texture, or texture units, to the rendering pipeline. This allowed multiple textures to be blended per pixel during rasterization. OpenGL 1.3 Released August 14, 2001. OpenGL 1.3 added support for cubemap texture, multi-texturing, multi-sampling, and texture unit combine operations (add, combine, dot3, border clamp). OpenGL 1.4 Released July 24, 2002. OpenGL 1.4 added hardware shadowing support, fog coordinates, automatic mipmap generation, and additional texture modes.

http://www.songho.ca/opengl/gl v bo.html[vbos), occlusionqueries, andex [0] Introduction to OpenGL OpenGL Shading Language OpenGL 2.0 Released September 7, 2004. OpenGL 2.0 added support for a true, GPU-based assembly language called ARB (designed by the Architecture Review Board), which would become the standard for vertex and fragment shaders. Cards released with OpenGL 2.0 were the first to offer user-programmable shaders. OpenGL 2.0 was conceived by 3Dlabs to address concerns that OpenGL was stagnating and lacked a strong direction 3Dlabs proposed a number of major additions to the standard Most of these were, at the time, rejected by the ARB or otherwise never came to fruition in the form that 3Dlabs proposed However, their proposal for a C-style shading language was eventually completed, resulting in the current formulation of GLSL (the OpenGL Shading Language, also slang) Like the assembly-like shading languages that it was replacing, it allowed the programmer to replace the fixed-function vertex and fragment pipe with shaders, though this time written in a C-like high-level language. The design of GLSL was notable for making relatively few concessions to the limitations of the hardware then available; this hearkened back to the earlier tradition of OpenGL setting an ambitious, forward-looking target for 3D accelerators rather than OpenGL 2.1 Released July 2, 2006. OpenGL 2.1 introduced support for pixel buffer objects (PBOs), srgb textures (gamma-corrected textures), and non-square matrices, and the Shading Language revision GLSL 1.20.[15]

Features of OpenGL 3.0 OpenGL Shading Language revision 1.30 (GLSL) OpenGL 3.0 Released July 11, 2008. OpenGL 3.0 added support for frame buffer objects, hardware instancing, vertex array objects (VAOs), and srgb framebuffers (gamma 2.2).[16] OpenGL 3.0 introduced a deprecation mechanism to simplify the API in future revisions. Vertex Array Objects More flexible Framebuffer Objects 32-bit (single precision) floating-point textures and render buffers 16-bit (half precision) floating-point vertex and pixel data Ability to render vertex transformations into a buffer Texture arrays 32-bit (single precision) floating point depth buffer support Features of OpenGL 3.1 OpenGL Shading Language revision 1.40 (GLSL) OpenGL 3.1 Released March 24, 2009 and updated May 28, 2009. OpenGL 3.1 introduces a range of features to make the API more convenient to use, in addition to performance oriented features Texture Buffer Objects - a new texture type that holds a one-dimensional array of texels Uniform Buffer Objects for fast data share/update Signed normalized textures (±1.0 range) Aminimumof16 texture units accessible by the vertex shader Primitive restart Instancing -drawingofobjectsmultipletimesthroughthere-useof vertex data CopyBuffer API for fast data copy; used in conjunction with OpenCL

OpenGL 3.2 Released 3 August 2009 and updated 7 December 2009. OpenGL Shading Language revision 1.50 (GLSL) Geometry Shader support BGRA vertex component ordering Shader Fragment coordinate convention control Seamless cube map filtering Fragment depth clamping Multisampled textures and texture samples for specific sample locations Sync and Fence objects OpenGL 4.0 Released 11 March 2010 SupportedCards : nvidiageforcegtx 400series, ATIRadeonHD5000series Features of OpenGL 4 OpenGL Shading Language revision 4.00 (GLSL) Two new shader stages that enable the GPU to offload geometry tessellation from the CPU. Per-sample fragment shaders and programmable fragment shader input positions for increased rendering quality and anti-aliasing flexibility Shader subroutines for significantly increased programming flexibility. Separation of texture state and texture data through the addition of a new object type called sampler objects. Drawing of data generated by OpenGL or external APIs such as OpenCL, without CPU intervention. 64-bit double precision floating point shader operations and inputs/outputs for increased rendering accuracy and quality. OpenGL Shading Language GLSL This document describes a programming language that is a companion to OpenGL 4.0 and higher, called The OpenGL Shading Language. The OpenGL Shading Language is part of the core OpenGL 4.0 specification. The recent trend in graphics hardware has been to replace fixed functionality with programmability in areas that have grown exceedingly complex (e.g., vertex processing and fragment processing) The OpenGL Shading Language has been designed to allow application programmers to express the processing that occurs at those programmable points of the OpenGL pipeline Independently compilable units that are written in this language are called shaders Performance improvements; such as instanced geometry shaders,

Agraphicsprogramisasetofshaders A program is a set of shaders that are compiled and linked together. The aim of this document is to thoroughly specify the programming language The OpenGL entry points that are used to manipulate and communicate with programs and shaders are defined separately from this language specification. The OpenGL Shading Language is based on ANSI C and many of the features have been retained except when they conflict with performance or ease of implementation Chasbeenextendedwithvectorandmatrixtypes(withhardware based qualifiers) to make it more concise for the typical operations carried out in 3D graphics Some mechanisms from C++ have also been borrowed, such as overloading functions based on argument types, and ability to declare variables where they are first needed instead of at the beginning of blocks.