SlideShare a Scribd company logo
1 of 34
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

What's hot

Lecture 6 introduction to open gl and glut
Lecture 6   introduction to open gl and glutLecture 6   introduction to open gl and glut
Lecture 6 introduction to open gl and glutsimpleok
 
Open Graphics Library
Open Graphics  Library Open Graphics  Library
Open Graphics Library Azmeen Gadit
 
NVIDIA OpenGL 4.6 in 2017
NVIDIA OpenGL 4.6 in 2017NVIDIA OpenGL 4.6 in 2017
NVIDIA OpenGL 4.6 in 2017Mark Kilgard
 
Skia & Freetype - Android 2D Graphics Essentials
Skia & Freetype - Android 2D Graphics EssentialsSkia & Freetype - Android 2D Graphics Essentials
Skia & Freetype - Android 2D Graphics EssentialsKyungmin Lee
 
NVIDIA's OpenGL Functionality
NVIDIA's OpenGL FunctionalityNVIDIA's OpenGL Functionality
NVIDIA's OpenGL FunctionalityMark Kilgard
 
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)Nanik Tolaram
 
Graphics software
Graphics softwareGraphics software
Graphics softwareMohd Arif
 
Graphics programming in open gl
Graphics programming in open glGraphics programming in open gl
Graphics programming in open glArvind Devaraj
 
GANs Presentation.pptx
GANs Presentation.pptxGANs Presentation.pptx
GANs Presentation.pptxMAHMOUD729246
 
Computer graphics notes
Computer graphics notesComputer graphics notes
Computer graphics notessmruti sarangi
 
Advanced Programming C++
Advanced Programming C++Advanced Programming C++
Advanced Programming C++guestf0562b
 
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPTHOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPTAhtesham Ullah khan
 
Siggraph 2016 - Vulkan and nvidia : the essentials
Siggraph 2016 - Vulkan and nvidia : the essentialsSiggraph 2016 - Vulkan and nvidia : the essentials
Siggraph 2016 - Vulkan and nvidia : the essentialsTristan Lorach
 
Modern OpenGL Usage: Using Vertex Buffer Objects Well
Modern OpenGL Usage: Using Vertex Buffer Objects Well Modern OpenGL Usage: Using Vertex Buffer Objects Well
Modern OpenGL Usage: Using Vertex Buffer Objects Well Mark Kilgard
 
OIT to Volumetric Shadow Mapping, 101 Uses for Raster-Ordered Views using Dir...
OIT to Volumetric Shadow Mapping, 101 Uses for Raster-Ordered Views using Dir...OIT to Volumetric Shadow Mapping, 101 Uses for Raster-Ordered Views using Dir...
OIT to Volumetric Shadow Mapping, 101 Uses for Raster-Ordered Views using Dir...Gael Hofemeier
 

What's hot (20)

Open gl
Open glOpen gl
Open gl
 
Lecture 6 introduction to open gl and glut
Lecture 6   introduction to open gl and glutLecture 6   introduction to open gl and glut
Lecture 6 introduction to open gl and glut
 
Open Graphics Library
Open Graphics  Library Open Graphics  Library
Open Graphics Library
 
Opengl basics
Opengl basicsOpengl basics
Opengl basics
 
NVIDIA OpenGL 4.6 in 2017
NVIDIA OpenGL 4.6 in 2017NVIDIA OpenGL 4.6 in 2017
NVIDIA OpenGL 4.6 in 2017
 
Skia & Freetype - Android 2D Graphics Essentials
Skia & Freetype - Android 2D Graphics EssentialsSkia & Freetype - Android 2D Graphics Essentials
Skia & Freetype - Android 2D Graphics Essentials
 
NVIDIA's OpenGL Functionality
NVIDIA's OpenGL FunctionalityNVIDIA's OpenGL Functionality
NVIDIA's OpenGL Functionality
 
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
 
Graphics software
Graphics softwareGraphics software
Graphics software
 
Graphics programming in open gl
Graphics programming in open glGraphics programming in open gl
Graphics programming in open gl
 
GANs Presentation.pptx
GANs Presentation.pptxGANs Presentation.pptx
GANs Presentation.pptx
 
Direct X
Direct XDirect X
Direct X
 
Computer graphics notes
Computer graphics notesComputer graphics notes
Computer graphics notes
 
Advanced Programming C++
Advanced Programming C++Advanced Programming C++
Advanced Programming C++
 
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPTHOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
 
Siggraph 2016 - Vulkan and nvidia : the essentials
Siggraph 2016 - Vulkan and nvidia : the essentialsSiggraph 2016 - Vulkan and nvidia : the essentials
Siggraph 2016 - Vulkan and nvidia : the essentials
 
Modern OpenGL Usage: Using Vertex Buffer Objects Well
Modern OpenGL Usage: Using Vertex Buffer Objects Well Modern OpenGL Usage: Using Vertex Buffer Objects Well
Modern OpenGL Usage: Using Vertex Buffer Objects Well
 
OIT to Volumetric Shadow Mapping, 101 Uses for Raster-Ordered Views using Dir...
OIT to Volumetric Shadow Mapping, 101 Uses for Raster-Ordered Views using Dir...OIT to Volumetric Shadow Mapping, 101 Uses for Raster-Ordered Views using Dir...
OIT to Volumetric Shadow Mapping, 101 Uses for Raster-Ordered Views using Dir...
 
3D Transformation
3D Transformation 3D Transformation
3D Transformation
 
Shaders in Unity
Shaders in UnityShaders in Unity
Shaders in Unity
 

Similar to OpenGL basics

OpenGL Shading Language
OpenGL Shading LanguageOpenGL Shading Language
OpenGL Shading LanguageJungsoo Nam
 
Shader Programming With Unity
Shader Programming With UnityShader Programming With Unity
Shader Programming With UnityMindstorm Studios
 
OpenGL - Bringing the 3D World into the Android
OpenGL - Bringing the 3D World into the AndroidOpenGL - Bringing the 3D World into the Android
OpenGL - Bringing the 3D World into the AndroidDroidConTLV
 
Android open gl2_droidcon_2014
Android open gl2_droidcon_2014Android open gl2_droidcon_2014
Android open gl2_droidcon_2014Droidcon Berlin
 
CS 354 Programmable Shading
CS 354 Programmable ShadingCS 354 Programmable Shading
CS 354 Programmable ShadingMark Kilgard
 
OpenGL Transformation
OpenGL TransformationOpenGL Transformation
OpenGL TransformationSandip Jadhav
 
CG simple openGL point & line-course 2
CG simple openGL point & line-course 2CG simple openGL point & line-course 2
CG simple openGL point & line-course 2fungfung Chen
 
Gdc 14 bringing unreal engine 4 to open_gl
Gdc 14 bringing unreal engine 4 to open_glGdc 14 bringing unreal engine 4 to open_gl
Gdc 14 bringing unreal engine 4 to open_glchangehee lee
 
Clean architecture for shaders unite2019
Clean architecture for shaders unite2019Clean architecture for shaders unite2019
Clean architecture for shaders unite2019Abhilash Majumder
 
NVIDIA OpenGL in 2016
NVIDIA OpenGL in 2016NVIDIA OpenGL in 2016
NVIDIA OpenGL in 2016Mark Kilgard
 
3 CG_U1_P2_PPT_3 OpenGL.pptx
3 CG_U1_P2_PPT_3 OpenGL.pptx3 CG_U1_P2_PPT_3 OpenGL.pptx
3 CG_U1_P2_PPT_3 OpenGL.pptxssuser255bf1
 
02 direct3 d_pipeline
02 direct3 d_pipeline02 direct3 d_pipeline
02 direct3 d_pipelineGirish Ghate
 

Similar to OpenGL basics (20)

OpenGL Shading Language
OpenGL Shading LanguageOpenGL Shading Language
OpenGL Shading Language
 
Shader Programming With Unity
Shader Programming With UnityShader Programming With Unity
Shader Programming With Unity
 
OpenGL - Bringing the 3D World into the Android
OpenGL - Bringing the 3D World into the AndroidOpenGL - Bringing the 3D World into the Android
OpenGL - Bringing the 3D World into the Android
 
Programmable Piplelines
Programmable PiplelinesProgrammable Piplelines
Programmable Piplelines
 
Chapter-3.pdf
Chapter-3.pdfChapter-3.pdf
Chapter-3.pdf
 
Android open gl2_droidcon_2014
Android open gl2_droidcon_2014Android open gl2_droidcon_2014
Android open gl2_droidcon_2014
 
CS 354 Programmable Shading
CS 354 Programmable ShadingCS 354 Programmable Shading
CS 354 Programmable Shading
 
OpenGL Transformation
OpenGL TransformationOpenGL Transformation
OpenGL Transformation
 
Introduction to OpenGL.ppt
Introduction to OpenGL.pptIntroduction to OpenGL.ppt
Introduction to OpenGL.ppt
 
CG simple openGL point & line-course 2
CG simple openGL point & line-course 2CG simple openGL point & line-course 2
CG simple openGL point & line-course 2
 
september11.ppt
september11.pptseptember11.ppt
september11.ppt
 
Gdc 14 bringing unreal engine 4 to open_gl
Gdc 14 bringing unreal engine 4 to open_glGdc 14 bringing unreal engine 4 to open_gl
Gdc 14 bringing unreal engine 4 to open_gl
 
Clean architecture for shaders unite2019
Clean architecture for shaders unite2019Clean architecture for shaders unite2019
Clean architecture for shaders unite2019
 
NVIDIA OpenGL in 2016
NVIDIA OpenGL in 2016NVIDIA OpenGL in 2016
NVIDIA OpenGL in 2016
 
3 CG_U1_P2_PPT_3 OpenGL.pptx
3 CG_U1_P2_PPT_3 OpenGL.pptx3 CG_U1_P2_PPT_3 OpenGL.pptx
3 CG_U1_P2_PPT_3 OpenGL.pptx
 
2D graphics
2D graphics2D graphics
2D graphics
 
18csl67 vtu lab manual
18csl67 vtu lab manual18csl67 vtu lab manual
18csl67 vtu lab manual
 
Android native gl
Android native glAndroid native gl
Android native gl
 
02 direct3 d_pipeline
02 direct3 d_pipeline02 direct3 d_pipeline
02 direct3 d_pipeline
 
OpenGL Interaction
OpenGL InteractionOpenGL Interaction
OpenGL Interaction
 

Recently uploaded

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 

Recently uploaded (20)

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 

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