OpenGL Essentials Training 3-day session Overview Understanding principles of 3D programming Understanding drawing Primitives Understanding transformation matrix and Coloring Understanding Blending and Texture mapping Understanding Shaders programming and Display List. Understanding OpenGL integration with Qt Duration Three days - 24 hours (8 hours a day) 50% of lecture, 50% of practical labs. Trainer http://www.linkedin.com/in/pravinkumarsinha Audience Professional 3D Software developers Prerequisite Knowledge of C programming In particular, participants must be familiar with creating and dealing with complex data types and structures, with pointers to such symbols, as well as with function pointers. Advance C training agenda is available at http://www.minhinc.com/training/c/advance-c-agenda.php and can be downloaded from http://www.minhinc.com/training/advance-c-agenda.pdf Knowledge of Object Oriented Concepts Qt integration requires Oops concept like Abstraction, Inheritance, Polymorphism knowledge. Setup Linux machine with GNU C++ compiler with Qt OpenGL version installed. www.minhinc.com p1
Lecture Lecture session will be course content presentation through the trainer. Any source code example related to the topic will be demonstrated, it would include executing the binaries. Complete lecture material can be downloaded from http://www.minhinc.com/training/advance-gl-slides.pdf Labs Labs session would be completely hands on session where each example (with example data and execution instruction) would be provided to the students. Students can verify their results with the results provided in the material. Day 1 Morning Lecture - Introduction GPUs Shaders Hardware acceleration OpenGL History and evolution Graphics terminologies, i.e. Display list, Resolution, Modeling, Geometry Representation, Evaluators, Primitives, Pixel Operations, Rasterization, Fragment Operation) Command Syntax State machine Rendering Pipeline OpenGL, OpenGLES, GLX and WebGL GLU and GLEW GLUT, GLFW and OpenGL utility Toolkit Lecture - Drawing Primitives Describing points, lines and polygon State management Normal vector Vertex array Attribute groups Inline functions glu library function Buffer Objects Example, building sphere, cylinder, cone Lecture - Viewing Transformations Viewing and Modeling transformations Projection and Viewport transformations Grand coordinate systems Fix coordinate systems Managing Local coordinate systems Manipulating Matrix Stacks. - ModelView matrix - Project matrix Example, Building a solar system Lecture - Color & Lighting RGBA and Color index mode Color and Shading mode Creating Light source Selecting lighting model Defining material properties www.minhinc.com p2
Day 1 Afternoon Lab Draw a cylinder using normal glvertex Draw a cylinder using vertex array Validate if transformations are not associative. i.e translation+roation not same to rotation+translaton Add a moon to mars in solar system Draw sphere using glu library. Add and move light source near and far. Let add lighting support in solar system through sun. Day 2 Morning Lecture - Blending, Antialiasing, Fog and Polygon Offset The source and destination factors in blending Three dimensional blending with the Depth Buffer Antialiasing Geometric Primitives with Multisampling Fog equations Polygon Offset Lecture - Display List & Pixel Operation Creating and executing a display list Executing multiple display lists Managing state variable with display lists Bitmaps and Fonts Images Imaging pipeline - Pixel Packing and Unpacking, 32 and 64 bit - Controlling Pixel-Storage Modes, 32-64 bit - Pixel-Transfer Operations - Pixel Mapping Using Buffer Objects with Pixel Rectangle Data - Using Buffer Objects in Transfer and Retrieve Pixel Data Lecture - Texture Mapping Steps in texture mapping Specifying the texture - Texture Proxy, Texture Array - Mipmaps:Multiple Level Filtering Texture Object Texture Functions - Texture combiner function Multitexturing The texture matrix stack Depth texture www.minhinc.com p3
Day 2 Afternoon Lecture - Framebuffer, Tessallators & Quadrics Color Buffer Depth Buffer Stencil Buffer Accumulation Buffer Polygon tessallation Quadrics:Rendering Spheres, Cylinders and disks Lecture - Evaluators and NURBS Evaluators The GLU NURBS Interfaces Lab Draw alphabet using DisplayList and Bitmap Apply texture on earth in Solar System Day 3 Morning Lecture - GLSL Shader Programming GLSL versions Syntax (Data types, statements, Functions and Sub routines) Various Shaders (vertex, fragment, geometry) and relations to Graphics Pipeline Creating Shader Inter Shader Communication Accessing Texture maps in shaders www.minhinc.com p4
Day 3 Afternoon Lecture - OpenGL integration with Qt gl functions through Qt -QOpenGLFunctions Framebuffer operations Vertex -QOpenGLVertexArrayObject -QSurfaceFormat -QOpenGLContext -QOpenGLFramebufferObject -QOpenGLFramebufferObjectFormat Window -QOpenGLWidget -initialzegl,resizegl,paintgl functions -painting 2D and 3D together Shader programming -QOpenGLShader -QOpenGLShaderProgram www.minhinc.com p5
Gl Essentials Gl Essenstials- Training Course www.minhinc.com p6
DISCLAIMER This document is edited on Cent OS 5 using Open Office 3.1.1 Draw Package. CentOS is freely download from centos.org/download Open Office 3.1.1 can be obtained through yum or through openoffice.org Text of this document is written in Bembo Std Otf(13 pt) font. Code parts are written in Consolas (10 pts) font. This training material is provided through Minh, Inc.,, B'lore, India Pdf version of this document is available at http://www.minhinc.com/training/advance-gl-slides.pdf For suggestion(s) or complaint(s) write to us at training@minhinc.com Document modified on 07/2018 Document contains 13 pages. www.minhinc.com p7
Day 1 Morning 1. Introduction OpenGL - Introduction GPUs, Shaders, Hadrdware Acceleration OpenGL History and evolution Abstract : OpengGL library is a software interface to graphics hardware. It does not provides any windowing system. - OpenGL provide 'C' programming interface to control graphics hardware. - OpenGL does not provide any windowing system or way to control user input. - OpenGL doesn't provide readymade 3D high level model, like automobile models. It instead provide basic point,line and polygon drawing primitives. GLU library uses glu basic primitives and provides high level mesh, Nurbs surface drawing algorthims. - OpenGL is just an alogorithms which takes input from a) Vertex primitives b) Textures in order to generate the framebuffer and then finally display buffer. --------------- ------------ texture vertex (pixel data) primitives --------------- ------------- +------------------------------+.. --------------- Per Fragment Operation --------------- --------------- Framebuffer Operation --------------- v Output data OpenGL basic architecture is to initialize the various drawing states then draw the primtives v --------------- Set the States for Primitives --------------- v -------------- Draw the Primitives -------------- v 1. Introduction OpenGL - Introduction Day 1 Morning GPUs, Shaders, Hadrdware Acceleration OpenGL History and evolution Abstract:Graphics process unit (GPU) is a special hardware that does faster mathematical computations for matrixes. GPU is a processing unit with its own physical memory. Vertex transformations and Fragment computations are done on GPU. GPU processes code written in shaders language. Shaders are fed to GPU to make the computation. Most used shaders are - Vertex shaders - Fragment shaders www.minhinc.com p8
1. Introduction OpenGL - Introduction GPUs, Shaders, Hadrdware Acceleration Day 1 Morning OpenGL History and evolution OpenGL is a 3D drawing c APIs developed by Silicon Graphics Inc. (SGI) in 1991. Where it inspired by available Iris 3D GL programming. First version 1.0 was released in 1992 without texture support. 1991-2006 - Silicon Graphics 2006 - Khronos Group Various OpenGL major releases OpenGL 1.0 (1992) OpenGL 1.1 (1997) - Vertex arrays - Polygon offsets - Texture - Texture proxy - Texture objects OpenGL 1.2(1998) - 3D textures - pixel formats - vertex array draw element range OpengL 1.3 (2001) - Multisample - Multitexture - Transpose matrix OpengGL 1.4 (2002) - Blend squaring - Depth textures and shadows - Fog coordinates - Multiple draw arrays - Stencil wrap OpenGL 1.5 (2003) - Buffer objects OpenGL 2.0 (2004)--+--- Shader Programming Language introduced - GLSL 1.1 - Shader programs +---- Fixed line functions implemetented through GLSL internally - Shader objects - Seprate stencil OpenGL 2.1 (2006) - GLSL 1.2 - Pixel buffer objects - srgb textures OpenGL 3.0 (2008) - GLSL 1.3 - Framebuffer objects - Multisample renderbuffer objects - conditional rendering - array textures Deprecated features - color index mode - Begin/End primitve - Fixed function vertex processing - Bitmaps - Pixel drawing - Polygon stripple - Display Lists - Texture borders - Alpha test - Accumuation buffers - Evaluators - Fixed function fragment processing - Shading language 1.10 and 1.20 OpenGL 3.1 (2009) www.minhinc.com p9
- GLSL 1.40 with Instancing - Deprecated features removed except wide lines - Buffer textures - Rectangle textures /----> core (only programming line functions) OpenGL 3.2 (2009)------- - GLSL 1.5 \----> compatibility (retaining fixed line functions) - Core(no deprecated function) and compatibility profiles(with deprecated functions) OpenGL 3.3 (2010) - GLSL 3.3 - Dual - source blending - Sample Objects - Texture swizzle - Instanced arrays - Vertex attributes 2.10.10.10 OpenGL 4.0 (2010) - GLSL 4.0 with tessalation on GPU, shaders with 64-bit precision - Buffer texture - Indirect drawing without multidraw OpenGL 4.1 (2010) - GLSL 4.1 developer-friendly debug output - compatibility with OpenGL ES 2.0 - Query and load binary blob for program objects OpenGL 4.2 (2011) - GLSL 4.20 Shaders with atomic counters - Allowing shaders to read and write images - Allowing incrementing/decrementing ad fetching of buffer object memory locations from shaders OpenGL 4.3 (2012) - GLSL 4.30 Compute shaders leveraging GPU parallelism - shader storage buffer objects OpenGL 4.4 (2013) - GLSL 4.40 Buffer Placement Control - Shader Variable Layout - Bindless Texture Extension - Sparse Texture Extension OpenGL 4.5 (2014) - GLSL 4.50 Direct State Access (DSA) - Flush Control - DX11 emulation features OpenGL 4.6 (2017) - GLSL 4.60 More efficient geometry processing and shader execution - polygon offset clamp - SPIR-V - anisotropic filtering Any functions introduced by venders gets vendor name, i.e NVI introduced constants are GL_NV_half_float, GL_HALF_FLOAT_NV and the function glvertex2hnv(). If these functions become ubiquitous then it is introduced as EXT or ARB (Archtecture review board) extension. Khronos group is new name for ARB group. OpenGL stack on Linux www.minhinc.com p10
www.minhinc.com p11
Left Blank www.minhinc.com p12
Minh, Inc. A SOFTWARE RESEARCH FIRM