SlideShare a Scribd company logo
OpenGL Basics
KOLIBER
What is OpenGL ? ( Open Graphics Library )
• Cross-language, Cross-Platform API for rendering 2D, 3D vector
graphics.
• The API is typically used to interact with a graphics processing unit
(GPU), to achieve hardware-accelerated rendering.
• Drivers: the people who make GPUs, are responsible for writing
implementations of the OpenGL rendering system. Their
implementations, commonly called "drivers“ , translate OpenGL API
commands into GPU commands
OpenGL usages
Games Animations and Videos
virtual realityCAD (Computer Aided Design )
Mobile phones
OpenGL platforms
Desktop Operation Systems
(OpenGL)
Embeded Devices (OpenGLES)
OpenGL platforms
Web based(WebGL)
OpenGL history
• 1991: Development started by SGI (Silicon Graphics INC. – ARB group (IBM ,
Microsoft , Nvidia , … ))
• 1992: OpenGL 1.0 launched (fixed functions/pipeline - legacy)
• 2000: OpenGL/ES 1.0 launched (embedded systems)
• 2004: OpenGL 2.0 released (programmable pipeline - GLSL/ shaders)
• 2005: OpenGL/SC 1.0 launched (safety critical)
• 2006: OpenGL 2.1 released (last release by SGI - to Khronos Group)
• 2008: OpenGL 3.0 released (first release by Khronos)
• 2016: Vulkan 1.0 launched (by Khronos – low driver overhead)
• 2017: OpenGL 4.6 released (last release by Khronos)
OpenGL history
OpenGL history
Deep into base !
OpenGL rendering pipeline
• At the first level OpenGL gets vertex array of our
model and our texture coordinates or ( color and
coordinates )
• At the second level OpenGL will translate , rotate ,
scale our vertices based on the transformation and
perspective matrices ( position calculator )
• At the third level OpenGL assembles our vertices
into triangles based on primitive type
• At the fourth level OpenGL rasterizes our triangles
into pixel format based on view port matrices and
• At the fifth level OpenGL will colorize and texturize
our pixels ( called fragment shader or pixel shader ) (
color chooser )
• At the sixth level OpenGL will test our pixels and do
some blending operations and at the end will write
pixels into framebuffer for showing in display
OpenGL rendering pipeline (Vertex/Fragment shader)
Vertex shader ( position calculator )
Fragment shader (color chooser )
Another simple view of OpenGL pipeline
OpenGL rendering pipeline (Triangle assembling)
Primitive types for triangle assembling at level two
OpenGL rendering pipeline (Testing) – OpenGL/SC
An important question ! (Texture mapping)
An important question ! (Texture mapping)
OpenGL texture mapping
OpenGL rendering pipeline (Vertex shader – Projection)
Deep into Vertex Shader!
Vertex Shaders (MVP)
• Model Matrix: Per model
(Model position)
• View Matrix: Camera
position
• Projection Matrix: Camera
projection (Orthographic,
Perspective, …)
• ModelView Matrix: Old
versions of OpenGL
(View*Model)
Vertex Shaders (MVP)
Transformation matrices (T)
• Scale
• Rotation
• Translation
• Scissors
• Reflection
• ...
PerspectiveRotate, Scale, Reflection, …
ScaleTranslation
Vertex Shader – Model Transformation Matrix
Vertex Shader – View Transformation Matrix
Vertex Shader – View Transformation Matrix (World transforms)
Camera (View) is fixed at Origin
Vertex Shader – Projection Transformation Matrix
• Perspective
• Orthographic
• …
Vertex Shader – Projection Transformation Matrix(Perspective)
• N: near
• F: far
• L: left
• T: top
• B: bottom
• R: right
Vertex Shader – Projection Transformation Matrix
Fragment Shader - Lighting
Let’s Code!
OpenGL libraries
• GL: OpenGL Core library ( rendering , drawing vertices , … ) (low level
API)
• GLU: OpenGL Utility library ( transforming , rotating , mathematical
operations over GPU , … ) (higher level API)
• GLUT: OpenGL Utility Toolkit library ( multiplatform window system
interface )
• GLFW: Graphics Library Frameword( multiplatform window system
interface ) (Handles joysticks, keyboard, mouse, …)
• SDL, FLTK, QT
• WGL, CGL, GLX
OpenGL libraries
OpenGL functions (gl.h)
• glVertex*(…)
• glColor*(…)
• glRotate*(…)
• glTranslate*(…)
• glScale*(…)
• glBegin(…)
• glEnd()
• glMatrixMode(…)
• glPushMatrix()
• glPopMatrix()
• glLoadIdentity()
• glOrtho(…)
• glFrustum(…)
• glEnable(…)
• glDisable(…)
• glLight*(…)
OpenGL functions (gl.h)(glFrustum)
Any question ?
Resources
• https://www.khronos.org/
• https://www.wikipedia.org/
• https://www.mesa3d.org/
• https://code.tutsplus.com/
• https://learnopengl.com
• https://open.gl/context
• http://www.songho.ca/opengl/gl_transform.html#example1
• http://in2gpu.com/2015/05/13/the-model-matrix/
• http://www.lighthouse3d.com/tutorials/glut-tutorial/keyboard-example-moving-
around-the-world/
• https://webglfundamentals.org/webgl/lessons/webgl-3d-camera.html

More Related Content

PDF
Opengl basics
PPTX
Opengl presentation
PPTX
OpenGL Introduction
PDF
Introduction of openGL
PPT
NVIDIA OpenGL 4.6 in 2017
PDF
from Binary to Binary: How Qemu Works
PDF
Understaing Android EGL
PPTX
Microsoft dot net framework
Opengl basics
Opengl presentation
OpenGL Introduction
Introduction of openGL
NVIDIA OpenGL 4.6 in 2017
from Binary to Binary: How Qemu Works
Understaing Android EGL
Microsoft dot net framework

What's hot (20)

PDF
Presentation systemc
PDF
The Validity of CNN to Time-Series Forecasting Problem
PPT
SIGGRAPH Asia 2008 Modern OpenGL
PDF
Horovod - Distributed TensorFlow Made Easy
PDF
Introduction to OpenCL
PDF
Device Tree for Dummies (ELC 2014)
PDF
Hardware Accelerated 2D Rendering for Android
PDF
LeNet-5
PDF
Convolutional Neural Network Models - Deep Learning
PDF
Unreal Engine 4 Introduction
PDF
OpenGLES - Graphics Programming in Android
PDF
ARM Trusted FirmwareのBL31を単体で使う!
PPSX
Vertex Shader Tricks by Bill Bilodeau - AMD at GDC14
PDF
Embedded Graphics Drivers in Mesa (ELCE 2019)
PPT
NVIDIA OpenGL in 2016
ODP
Q4.11: Porting Android to new Platforms
PDF
Recurrent Neural Networks (RNN) | RNN LSTM | Deep Learning Tutorial | Tensorf...
PDF
Natural Language Toolkit (NLTK), Basics
PPTX
Linux Initialization Process (1)
Presentation systemc
The Validity of CNN to Time-Series Forecasting Problem
SIGGRAPH Asia 2008 Modern OpenGL
Horovod - Distributed TensorFlow Made Easy
Introduction to OpenCL
Device Tree for Dummies (ELC 2014)
Hardware Accelerated 2D Rendering for Android
LeNet-5
Convolutional Neural Network Models - Deep Learning
Unreal Engine 4 Introduction
OpenGLES - Graphics Programming in Android
ARM Trusted FirmwareのBL31を単体で使う!
Vertex Shader Tricks by Bill Bilodeau - AMD at GDC14
Embedded Graphics Drivers in Mesa (ELCE 2019)
NVIDIA OpenGL in 2016
Q4.11: Porting Android to new Platforms
Recurrent Neural Networks (RNN) | RNN LSTM | Deep Learning Tutorial | Tensorf...
Natural Language Toolkit (NLTK), Basics
Linux Initialization Process (1)
Ad

Similar to OpenGL basics (20)

PPTX
What is OpenGL ?
PDF
Open gl
PDF
Computer Graphics - Lecture 01 - 3D Programming I
PPT
CS 354 Programmable Shading
PPT
Introduction to OpenGL modern OpenGL program
PPTX
OpenGL Shading Language
PDF
OpenGL ES on Android
PPT
OpenGL 4 for 2010
PPT
GTC 2009 OpenGL Barthold
PPT
september11.ppt
PPTX
3 CG_U1_P2_PPT_3 OpenGL.pptx
PPTX
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
 
PPT
Advanced Graphics Workshop - GFX2011
PDF
OpenGL ES 2.x Programming Introduction
PPTX
OpenGL - Bringing the 3D World into the Android
PDF
Graphics programming in open gl
PPT
Introduction to OpenGL.ppt
PPT
OpenGL 3.2 and More
PPT
NVIDIA's OpenGL Functionality
What is OpenGL ?
Open gl
Computer Graphics - Lecture 01 - 3D Programming I
CS 354 Programmable Shading
Introduction to OpenGL modern OpenGL program
OpenGL Shading Language
OpenGL ES on Android
OpenGL 4 for 2010
GTC 2009 OpenGL Barthold
september11.ppt
3 CG_U1_P2_PPT_3 OpenGL.pptx
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
 
Advanced Graphics Workshop - GFX2011
OpenGL ES 2.x Programming Introduction
OpenGL - Bringing the 3D World into the Android
Graphics programming in open gl
Introduction to OpenGL.ppt
OpenGL 3.2 and More
NVIDIA's OpenGL Functionality
Ad

Recently uploaded (20)

DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Cloud computing and distributed systems.
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Electronic commerce courselecture one. Pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Approach and Philosophy of On baking technology
The AUB Centre for AI in Media Proposal.docx
Dropbox Q2 2025 Financial Results & Investor Presentation
Cloud computing and distributed systems.
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Network Security Unit 5.pdf for BCA BBA.
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Reach Out and Touch Someone: Haptics and Empathic Computing
Review of recent advances in non-invasive hemoglobin estimation
Advanced methodologies resolving dimensionality complications for autism neur...
Digital-Transformation-Roadmap-for-Companies.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Electronic commerce courselecture one. Pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Encapsulation_ Review paper, used for researhc scholars
Approach and Philosophy of On baking technology

OpenGL basics

  • 2. What is OpenGL ? ( Open Graphics Library ) • Cross-language, Cross-Platform API for rendering 2D, 3D vector graphics. • The API is typically used to interact with a graphics processing unit (GPU), to achieve hardware-accelerated rendering. • Drivers: the people who make GPUs, are responsible for writing implementations of the OpenGL rendering system. Their implementations, commonly called "drivers“ , translate OpenGL API commands into GPU commands
  • 3. OpenGL usages Games Animations and Videos virtual realityCAD (Computer Aided Design ) Mobile phones
  • 4. OpenGL platforms Desktop Operation Systems (OpenGL) Embeded Devices (OpenGLES)
  • 6. OpenGL history • 1991: Development started by SGI (Silicon Graphics INC. – ARB group (IBM , Microsoft , Nvidia , … )) • 1992: OpenGL 1.0 launched (fixed functions/pipeline - legacy) • 2000: OpenGL/ES 1.0 launched (embedded systems) • 2004: OpenGL 2.0 released (programmable pipeline - GLSL/ shaders) • 2005: OpenGL/SC 1.0 launched (safety critical) • 2006: OpenGL 2.1 released (last release by SGI - to Khronos Group) • 2008: OpenGL 3.0 released (first release by Khronos) • 2016: Vulkan 1.0 launched (by Khronos – low driver overhead) • 2017: OpenGL 4.6 released (last release by Khronos)
  • 10. OpenGL rendering pipeline • At the first level OpenGL gets vertex array of our model and our texture coordinates or ( color and coordinates ) • At the second level OpenGL will translate , rotate , scale our vertices based on the transformation and perspective matrices ( position calculator ) • At the third level OpenGL assembles our vertices into triangles based on primitive type • At the fourth level OpenGL rasterizes our triangles into pixel format based on view port matrices and • At the fifth level OpenGL will colorize and texturize our pixels ( called fragment shader or pixel shader ) ( color chooser ) • At the sixth level OpenGL will test our pixels and do some blending operations and at the end will write pixels into framebuffer for showing in display
  • 11. OpenGL rendering pipeline (Vertex/Fragment shader) Vertex shader ( position calculator ) Fragment shader (color chooser ) Another simple view of OpenGL pipeline
  • 12. OpenGL rendering pipeline (Triangle assembling) Primitive types for triangle assembling at level two
  • 13. OpenGL rendering pipeline (Testing) – OpenGL/SC
  • 14. An important question ! (Texture mapping)
  • 15. An important question ! (Texture mapping) OpenGL texture mapping
  • 16. OpenGL rendering pipeline (Vertex shader – Projection)
  • 17. Deep into Vertex Shader!
  • 18. Vertex Shaders (MVP) • Model Matrix: Per model (Model position) • View Matrix: Camera position • Projection Matrix: Camera projection (Orthographic, Perspective, …) • ModelView Matrix: Old versions of OpenGL (View*Model)
  • 20. Transformation matrices (T) • Scale • Rotation • Translation • Scissors • Reflection • ... PerspectiveRotate, Scale, Reflection, … ScaleTranslation
  • 21. Vertex Shader – Model Transformation Matrix
  • 22. Vertex Shader – View Transformation Matrix
  • 23. Vertex Shader – View Transformation Matrix (World transforms) Camera (View) is fixed at Origin
  • 24. Vertex Shader – Projection Transformation Matrix • Perspective • Orthographic • …
  • 25. Vertex Shader – Projection Transformation Matrix(Perspective) • N: near • F: far • L: left • T: top • B: bottom • R: right
  • 26. Vertex Shader – Projection Transformation Matrix
  • 27. Fragment Shader - Lighting
  • 29. OpenGL libraries • GL: OpenGL Core library ( rendering , drawing vertices , … ) (low level API) • GLU: OpenGL Utility library ( transforming , rotating , mathematical operations over GPU , … ) (higher level API) • GLUT: OpenGL Utility Toolkit library ( multiplatform window system interface ) • GLFW: Graphics Library Frameword( multiplatform window system interface ) (Handles joysticks, keyboard, mouse, …) • SDL, FLTK, QT • WGL, CGL, GLX
  • 31. OpenGL functions (gl.h) • glVertex*(…) • glColor*(…) • glRotate*(…) • glTranslate*(…) • glScale*(…) • glBegin(…) • glEnd() • glMatrixMode(…) • glPushMatrix() • glPopMatrix() • glLoadIdentity() • glOrtho(…) • glFrustum(…) • glEnable(…) • glDisable(…) • glLight*(…)
  • 34. Resources • https://www.khronos.org/ • https://www.wikipedia.org/ • https://www.mesa3d.org/ • https://code.tutsplus.com/ • https://learnopengl.com • https://open.gl/context • http://www.songho.ca/opengl/gl_transform.html#example1 • http://in2gpu.com/2015/05/13/the-model-matrix/ • http://www.lighthouse3d.com/tutorials/glut-tutorial/keyboard-example-moving- around-the-world/ • https://webglfundamentals.org/webgl/lessons/webgl-3d-camera.html