SlideShare a Scribd company logo
1 of 17
OpenGL ES
on Android
OpenGL ES
â—Ź
â—Ź
â—Ź
â—Ź
â—Ź
â—Ź
â—Ź
â—Ź

subset of OpenGL for Embedded Systems
royalty free
adopted by every major handset OS
version 1.x fixed function
version 2.x fully programmable
version 3.x builds on version 2
http://www.khronos.org/opengles/
http://en.wikipedia.org/wiki/OpenGL_ES
Android GLSurfaceView
â—Ź
â—Ź
â—Ź
â—Ź
â—Ź
â—Ź

built in to Android
manages OpenGL ES surfaces
draws into the Android view system
provides dedicated render thread
handles EGL interface with window system
supports continuous or on-demand
rendering
â—Ź makes getting started relatively easy
Android Renderer
â—Ź a custom implementation
â—‹ GLSurfaceView.Renderer

â—Ź 3 interface methods called by system
â—‹ onSurfaceCreated
â—‹ onSurfaceChanged
â—‹ onDrawFrame

â—Ź define model data in renderer
â—‹ pass to OpenGL ES in onDrawFrame

â—Ź define matrices in renderer
Model Data
â—Ź OpenGL ES version 1
â—‹ set points and colors with direct method calls
glBegin(GL_TRIANGLES);
glVertex3f(-0.5f, -0.25f, 0.0f);
glColor3f(1.0f, 0.0f, 0.0f);
...
glEnd();

â—Ź OpenGL ES version 2
â—‹ define arrays and buffers to draw with
final float[] triangle1VerticesData = {
-0.5f, -0.25f, 0.0f, // X, Y, Z,
1.0f, 0.0f, 0.0f, 1.0f, // R, G, B, A
0.5f, -0.25f, 0.0f,
0.0f, 0.0f, 1.0f, 1.0f,
0.0f, 0.559016994f, 0.0f,
0.0f, 1.0f, 0.0f, 1.0f
};
Buffers
â—Ź
â—Ź
â—Ź
â—Ź

Android is written in Java
OpenGL ES is written in C
model data is passed via buffers
model data is cached somewhere
â—‹ client memory: FloatBuffer
â—‹ graphics memory: VBO, IBO
Matrices
â—Ź model matrix
â—‹ places a drawing in the world

â—Ź view matrix
â—‹ positions drawings relative to our eye

â—Ź projection matrix
â—‹ projects the view onto the screen
â—‹ enables 3 dimensional perspective
Shaders
â—Ź GLSL ES: http://www.khronos.org/opengles/sdk/docs/manglsl/
â—Ź model data passes through shaders
â—Ź vertex shaders
â—‹ perform operations on each vertex
â—‹ pass results to fragment shaders

â—Ź fragment shaders
â—‹ use results of vertex shaders
â—‹ applies additional operations per pixel
â—‹ draws to screen by sending data to OpenGL ES
Shader Program
â—Ź links vertex output to fragment input
â—Ź provides mechanism to pass model data
â—‹ App puts model data in buffers
â—‹ OpenGL ES passes data from buffers to shaders

â—Ź used by OpenGL ES to execute drawing
â—Ź App can have multiple shader programs
Light
â—Ź version 2 requires us to write our own lighting
â—‹ per-vertex
â—‹ per-fragment

â—Ź ray tracing
â—‹ very accurate and realistic but very expensive

â—Ź rasterization
â—‹ very good approximation
â—‹ fast enough for real time graphics on mobile devices
Light Types
â—Ź Ambient
â—‹ pervades entire scene, no single source
â—‹ indirect diffuse lighting

â—Ź Diffuse
â—‹ light from a source bounces directly off an object
â—‹ illumination of object depends on angle to source

â—Ź Specular
â—‹ moves as we move relative to an object
â—‹ perceived as "shininess"
Light Sources
â—Ź Directional
â—‹ consistent strength from undefined location
â—‹ consistent direction no matter where you are

â—Ź Point
â—‹ strength fades from a center point
â—‹ travels in all directions

â—Ź Spot
â—‹ strength fades from a point
â—‹ travels with attenuation and direction
Textures
â—Ź Coordination
â—‹ OpenGL y-axis is flipped relative to images
â–  more expensive: flip bitmap when loaded
â–  less expensive: flip texture coordinates
â—‹ texture coordinates are called texels
â—‹ (s,t) instead of (x,y)

â—Ź Load image bitmap into application
â—Ź Supply shaders with texture data
â—Ź Shaders draw the texture
Texture Filtering
â—Ź minification & magnification
â—Ź mipmapping
â—Ź nearest neighbor
â—‹ blocky when magnified

â—Ź bilinear
â—‹ smoother when magnified

â—Ź trilinear
â—‹ smoother when multiple levels are side by side
Blending
â—Ź effect of combining colors
â—Ź OpenGL provides several modes
â—‹ additive
â—‹ multiplicative
â—‹ interpolative

â—Ź occurs in fragment shader
â—‹ after calculating final color
â—‹ normally overwrites previous value
○ blending… blends with previous value
Vertex Buffer Objects
â—Ź instead of transferring data every frame
â—‹ from client memory to OpenGL

â—Ź transfer once and draw from graphics cache
â—Ź generate an OpenGL buffer
â—‹ give it the data in the client buffer
â—‹ free client memory
Index Buffer Objects
â—Ź VBO's can contain a lot of redundant data
â—‹ specifically, redundant vertex data

â—Ź instead, define each vertex once only in IBO
â—Ź reference each vertex by index in IBO

More Related Content

What's hot

OpenGL Shading Language
OpenGL Shading LanguageOpenGL Shading Language
OpenGL Shading LanguageJungsoo Nam
 
Baiscs of OpenGL
Baiscs of OpenGLBaiscs of OpenGL
Baiscs of OpenGLMrinmoy Dalal
 
Open gl
Open glOpen gl
Open glEU Edge
 
OpenGLES - Graphics Programming in Android
OpenGLES - Graphics Programming in Android OpenGLES - Graphics Programming in Android
OpenGLES - Graphics Programming in Android Arvind Devaraj
 
Opengl basics
Opengl basicsOpengl basics
Opengl basicspushpa latha
 
Graphics programming in open gl
Graphics programming in open glGraphics programming in open gl
Graphics programming in open glArvind Devaraj
 
Understaing Android EGL
Understaing Android EGLUnderstaing Android EGL
Understaing Android EGLSuhan Lee
 
Chapter02 graphics-programming
Chapter02 graphics-programmingChapter02 graphics-programming
Chapter02 graphics-programmingMohammed Romi
 
Open gl introduction
Open gl introduction Open gl introduction
Open gl introduction abigail Dayrit
 
OpenGL 3.2 and More
OpenGL 3.2 and MoreOpenGL 3.2 and More
OpenGL 3.2 and MoreMark Kilgard
 
Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011Prabindh Sundareson
 
NVIDIA's OpenGL Functionality
NVIDIA's OpenGL FunctionalityNVIDIA's OpenGL Functionality
NVIDIA's OpenGL FunctionalityMark Kilgard
 
OpenGL for 2015
OpenGL for 2015OpenGL for 2015
OpenGL for 2015Mark Kilgard
 
SIGGRAPH Asia 2008 Modern OpenGL
SIGGRAPH Asia 2008 Modern OpenGLSIGGRAPH Asia 2008 Modern OpenGL
SIGGRAPH Asia 2008 Modern OpenGLMark Kilgard
 
Migrating from OpenGL to Vulkan
Migrating from OpenGL to VulkanMigrating from OpenGL to Vulkan
Migrating from OpenGL to VulkanMark Kilgard
 
OpenGL 4 for 2010
OpenGL 4 for 2010OpenGL 4 for 2010
OpenGL 4 for 2010Mark Kilgard
 
OpenGL Transformation
OpenGL TransformationOpenGL Transformation
OpenGL TransformationSandip Jadhav
 
Computer Graphics Project Report on Sinking Ship using OpenGL
Computer Graphics Project Report on Sinking Ship using OpenGL Computer Graphics Project Report on Sinking Ship using OpenGL
Computer Graphics Project Report on Sinking Ship using OpenGL Sharath Raj
 
CS 354 Introduction
CS 354 IntroductionCS 354 Introduction
CS 354 IntroductionMark Kilgard
 

What's hot (20)

OpenGL Shading Language
OpenGL Shading LanguageOpenGL Shading Language
OpenGL Shading Language
 
Baiscs of OpenGL
Baiscs of OpenGLBaiscs of OpenGL
Baiscs of OpenGL
 
Open gl
Open glOpen gl
Open gl
 
OpenGLES - Graphics Programming in Android
OpenGLES - Graphics Programming in Android OpenGLES - Graphics Programming in Android
OpenGLES - Graphics Programming in Android
 
Opengl basics
Opengl basicsOpengl basics
Opengl basics
 
Graphics programming in open gl
Graphics programming in open glGraphics programming in open gl
Graphics programming in open gl
 
Understaing Android EGL
Understaing Android EGLUnderstaing Android EGL
Understaing Android EGL
 
Chapter02 graphics-programming
Chapter02 graphics-programmingChapter02 graphics-programming
Chapter02 graphics-programming
 
Open gl introduction
Open gl introduction Open gl introduction
Open gl introduction
 
OpenGL Basics
OpenGL BasicsOpenGL Basics
OpenGL Basics
 
OpenGL 3.2 and More
OpenGL 3.2 and MoreOpenGL 3.2 and More
OpenGL 3.2 and More
 
Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011
 
NVIDIA's OpenGL Functionality
NVIDIA's OpenGL FunctionalityNVIDIA's OpenGL Functionality
NVIDIA's OpenGL Functionality
 
OpenGL for 2015
OpenGL for 2015OpenGL for 2015
OpenGL for 2015
 
SIGGRAPH Asia 2008 Modern OpenGL
SIGGRAPH Asia 2008 Modern OpenGLSIGGRAPH Asia 2008 Modern OpenGL
SIGGRAPH Asia 2008 Modern OpenGL
 
Migrating from OpenGL to Vulkan
Migrating from OpenGL to VulkanMigrating from OpenGL to Vulkan
Migrating from OpenGL to Vulkan
 
OpenGL 4 for 2010
OpenGL 4 for 2010OpenGL 4 for 2010
OpenGL 4 for 2010
 
OpenGL Transformation
OpenGL TransformationOpenGL Transformation
OpenGL Transformation
 
Computer Graphics Project Report on Sinking Ship using OpenGL
Computer Graphics Project Report on Sinking Ship using OpenGL Computer Graphics Project Report on Sinking Ship using OpenGL
Computer Graphics Project Report on Sinking Ship using OpenGL
 
CS 354 Introduction
CS 354 IntroductionCS 354 Introduction
CS 354 Introduction
 

Similar to OpenGL ES on Android

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
 
Smedberg niklas bringing_aaa_graphics
Smedberg niklas bringing_aaa_graphicsSmedberg niklas bringing_aaa_graphics
Smedberg niklas bringing_aaa_graphicschangehee lee
 
Computer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming IComputer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming Iđź’» Anton Gerdelan
 
openGL basics for sample program (1).ppt
openGL basics for sample program (1).pptopenGL basics for sample program (1).ppt
openGL basics for sample program (1).pptHIMANKMISHRA2
 
openGL basics for sample program.ppt
openGL basics for sample program.pptopenGL basics for sample program.ppt
openGL basics for sample program.pptHIMANKMISHRA2
 
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
 
Volodymyr Lyubinets “Generative models for images”
Volodymyr Lyubinets  “Generative models for images”Volodymyr Lyubinets  “Generative models for images”
Volodymyr Lyubinets “Generative models for images”Lviv Startup Club
 
Power of WebGL (FSTO 2014)
Power of WebGL (FSTO 2014)Power of WebGL (FSTO 2014)
Power of WebGL (FSTO 2014)Verold
 
Unreal Open Day 2017 UE4 for Mobile: The Future of High Quality Mobile Games
Unreal Open Day 2017 UE4 for Mobile: The Future of High Quality Mobile GamesUnreal Open Day 2017 UE4 for Mobile: The Future of High Quality Mobile Games
Unreal Open Day 2017 UE4 for Mobile: The Future of High Quality Mobile GamesEpic Games China
 
OpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI PlatformsOpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI PlatformsPrabindh Sundareson
 
Graphics Libraries
Graphics LibrariesGraphics Libraries
Graphics LibrariesPrachi Mishra
 
Programmable Piplelines
Programmable PiplelinesProgrammable Piplelines
Programmable PiplelinesSyed Zaid Irshad
 
Arkanoid Game
Arkanoid GameArkanoid Game
Arkanoid Gamegraphitech
 
18csl67 vtu lab manual
18csl67 vtu lab manual18csl67 vtu lab manual
18csl67 vtu lab manualNatsuDragoneel5
 
Dissecting the Rendering of The Surge
Dissecting the Rendering of The SurgeDissecting the Rendering of The Surge
Dissecting the Rendering of The SurgePhilip Hammer
 
State of the Art OpenGL and Qt
State of the Art OpenGL and QtState of the Art OpenGL and Qt
State of the Art OpenGL and QtICS
 
COMPUTER GRAPHICS PROJECT REPORT
COMPUTER GRAPHICS PROJECT REPORTCOMPUTER GRAPHICS PROJECT REPORT
COMPUTER GRAPHICS PROJECT REPORTvineet raj
 
Project meeting: Android Graphics Architecture Overview
Project meeting: Android Graphics Architecture OverviewProject meeting: Android Graphics Architecture Overview
Project meeting: Android Graphics Architecture OverviewYu-Hsin Hung
 
Computer graphics - Nitish Nagar
Computer graphics - Nitish NagarComputer graphics - Nitish Nagar
Computer graphics - Nitish NagarNitish Nagar
 

Similar to OpenGL ES on Android (20)

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
 
Smedberg niklas bringing_aaa_graphics
Smedberg niklas bringing_aaa_graphicsSmedberg niklas bringing_aaa_graphics
Smedberg niklas bringing_aaa_graphics
 
Computer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming IComputer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming I
 
openGL basics for sample program (1).ppt
openGL basics for sample program (1).pptopenGL basics for sample program (1).ppt
openGL basics for sample program (1).ppt
 
openGL basics for sample program.ppt
openGL basics for sample program.pptopenGL basics for sample program.ppt
openGL basics for sample program.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
 
Volodymyr Lyubinets “Generative models for images”
Volodymyr Lyubinets  “Generative models for images”Volodymyr Lyubinets  “Generative models for images”
Volodymyr Lyubinets “Generative models for images”
 
Power of WebGL (FSTO 2014)
Power of WebGL (FSTO 2014)Power of WebGL (FSTO 2014)
Power of WebGL (FSTO 2014)
 
Chapter-3.pdf
Chapter-3.pdfChapter-3.pdf
Chapter-3.pdf
 
Unreal Open Day 2017 UE4 for Mobile: The Future of High Quality Mobile Games
Unreal Open Day 2017 UE4 for Mobile: The Future of High Quality Mobile GamesUnreal Open Day 2017 UE4 for Mobile: The Future of High Quality Mobile Games
Unreal Open Day 2017 UE4 for Mobile: The Future of High Quality Mobile Games
 
OpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI PlatformsOpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI Platforms
 
Graphics Libraries
Graphics LibrariesGraphics Libraries
Graphics Libraries
 
Programmable Piplelines
Programmable PiplelinesProgrammable Piplelines
Programmable Piplelines
 
Arkanoid Game
Arkanoid GameArkanoid Game
Arkanoid Game
 
18csl67 vtu lab manual
18csl67 vtu lab manual18csl67 vtu lab manual
18csl67 vtu lab manual
 
Dissecting the Rendering of The Surge
Dissecting the Rendering of The SurgeDissecting the Rendering of The Surge
Dissecting the Rendering of The Surge
 
State of the Art OpenGL and Qt
State of the Art OpenGL and QtState of the Art OpenGL and Qt
State of the Art OpenGL and Qt
 
COMPUTER GRAPHICS PROJECT REPORT
COMPUTER GRAPHICS PROJECT REPORTCOMPUTER GRAPHICS PROJECT REPORT
COMPUTER GRAPHICS PROJECT REPORT
 
Project meeting: Android Graphics Architecture Overview
Project meeting: Android Graphics Architecture OverviewProject meeting: Android Graphics Architecture Overview
Project meeting: Android Graphics Architecture Overview
 
Computer graphics - Nitish Nagar
Computer graphics - Nitish NagarComputer graphics - Nitish Nagar
Computer graphics - Nitish Nagar
 

More from Chris Farrell

iOS: A Broad Overview
iOS: A Broad OverviewiOS: A Broad Overview
iOS: A Broad OverviewChris Farrell
 
Android security
Android securityAndroid security
Android securityChris Farrell
 
Function Points
Function PointsFunction Points
Function PointsChris Farrell
 
Classic Mistakes
Classic MistakesClassic Mistakes
Classic MistakesChris Farrell
 
Code Kata: String Calculator in Flex
Code Kata: String Calculator in FlexCode Kata: String Calculator in Flex
Code Kata: String Calculator in FlexChris Farrell
 
Software Development Fundamentals
Software Development FundamentalsSoftware Development Fundamentals
Software Development FundamentalsChris Farrell
 
JavaScript: Patterns, Part 3
JavaScript: Patterns, Part  3JavaScript: Patterns, Part  3
JavaScript: Patterns, Part 3Chris Farrell
 
JavaScript: Patterns, Part 2
JavaScript: Patterns, Part  2JavaScript: Patterns, Part  2
JavaScript: Patterns, Part 2Chris Farrell
 
JavaScript: Patterns, Part 1
JavaScript: Patterns, Part  1JavaScript: Patterns, Part  1
JavaScript: Patterns, Part 1Chris Farrell
 
JavaScript: The Good Parts
JavaScript: The Good PartsJavaScript: The Good Parts
JavaScript: The Good PartsChris Farrell
 
iOS release engineering
iOS release engineeringiOS release engineering
iOS release engineeringChris Farrell
 

More from Chris Farrell (14)

iOS: A Broad Overview
iOS: A Broad OverviewiOS: A Broad Overview
iOS: A Broad Overview
 
Android security
Android securityAndroid security
Android security
 
Function Points
Function PointsFunction Points
Function Points
 
Classic Mistakes
Classic MistakesClassic Mistakes
Classic Mistakes
 
Code Kata: String Calculator in Flex
Code Kata: String Calculator in FlexCode Kata: String Calculator in Flex
Code Kata: String Calculator in Flex
 
Code Kata
Code KataCode Kata
Code Kata
 
Software Development Fundamentals
Software Development FundamentalsSoftware Development Fundamentals
Software Development Fundamentals
 
Clean Code
Clean CodeClean Code
Clean Code
 
JavaScript: Patterns, Part 3
JavaScript: Patterns, Part  3JavaScript: Patterns, Part  3
JavaScript: Patterns, Part 3
 
JavaScript: Patterns, Part 2
JavaScript: Patterns, Part  2JavaScript: Patterns, Part  2
JavaScript: Patterns, Part 2
 
JavaScript: Patterns, Part 1
JavaScript: Patterns, Part  1JavaScript: Patterns, Part  1
JavaScript: Patterns, Part 1
 
JavaScript: The Good Parts
JavaScript: The Good PartsJavaScript: The Good Parts
JavaScript: The Good Parts
 
iOS App Dev
iOS App Dev iOS App Dev
iOS App Dev
 
iOS release engineering
iOS release engineeringiOS release engineering
iOS release engineering
 

Recently uploaded

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
 
"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
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
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
 
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
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
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
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
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
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 

Recently uploaded (20)

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
 
"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...
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
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
 
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
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
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
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 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
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 

OpenGL ES on Android

  • 2. OpenGL ES â—Ź â—Ź â—Ź â—Ź â—Ź â—Ź â—Ź â—Ź subset of OpenGL for Embedded Systems royalty free adopted by every major handset OS version 1.x fixed function version 2.x fully programmable version 3.x builds on version 2 http://www.khronos.org/opengles/ http://en.wikipedia.org/wiki/OpenGL_ES
  • 3. Android GLSurfaceView â—Ź â—Ź â—Ź â—Ź â—Ź â—Ź built in to Android manages OpenGL ES surfaces draws into the Android view system provides dedicated render thread handles EGL interface with window system supports continuous or on-demand rendering â—Ź makes getting started relatively easy
  • 4. Android Renderer â—Ź a custom implementation â—‹ GLSurfaceView.Renderer â—Ź 3 interface methods called by system â—‹ onSurfaceCreated â—‹ onSurfaceChanged â—‹ onDrawFrame â—Ź define model data in renderer â—‹ pass to OpenGL ES in onDrawFrame â—Ź define matrices in renderer
  • 5. Model Data â—Ź OpenGL ES version 1 â—‹ set points and colors with direct method calls glBegin(GL_TRIANGLES); glVertex3f(-0.5f, -0.25f, 0.0f); glColor3f(1.0f, 0.0f, 0.0f); ... glEnd(); â—Ź OpenGL ES version 2 â—‹ define arrays and buffers to draw with final float[] triangle1VerticesData = { -0.5f, -0.25f, 0.0f, // X, Y, Z, 1.0f, 0.0f, 0.0f, 1.0f, // R, G, B, A 0.5f, -0.25f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.559016994f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f };
  • 6. Buffers â—Ź â—Ź â—Ź â—Ź Android is written in Java OpenGL ES is written in C model data is passed via buffers model data is cached somewhere â—‹ client memory: FloatBuffer â—‹ graphics memory: VBO, IBO
  • 7. Matrices â—Ź model matrix â—‹ places a drawing in the world â—Ź view matrix â—‹ positions drawings relative to our eye â—Ź projection matrix â—‹ projects the view onto the screen â—‹ enables 3 dimensional perspective
  • 8. Shaders â—Ź GLSL ES: http://www.khronos.org/opengles/sdk/docs/manglsl/ â—Ź model data passes through shaders â—Ź vertex shaders â—‹ perform operations on each vertex â—‹ pass results to fragment shaders â—Ź fragment shaders â—‹ use results of vertex shaders â—‹ applies additional operations per pixel â—‹ draws to screen by sending data to OpenGL ES
  • 9. Shader Program â—Ź links vertex output to fragment input â—Ź provides mechanism to pass model data â—‹ App puts model data in buffers â—‹ OpenGL ES passes data from buffers to shaders â—Ź used by OpenGL ES to execute drawing â—Ź App can have multiple shader programs
  • 10. Light â—Ź version 2 requires us to write our own lighting â—‹ per-vertex â—‹ per-fragment â—Ź ray tracing â—‹ very accurate and realistic but very expensive â—Ź rasterization â—‹ very good approximation â—‹ fast enough for real time graphics on mobile devices
  • 11. Light Types â—Ź Ambient â—‹ pervades entire scene, no single source â—‹ indirect diffuse lighting â—Ź Diffuse â—‹ light from a source bounces directly off an object â—‹ illumination of object depends on angle to source â—Ź Specular â—‹ moves as we move relative to an object â—‹ perceived as "shininess"
  • 12. Light Sources â—Ź Directional â—‹ consistent strength from undefined location â—‹ consistent direction no matter where you are â—Ź Point â—‹ strength fades from a center point â—‹ travels in all directions â—Ź Spot â—‹ strength fades from a point â—‹ travels with attenuation and direction
  • 13. Textures â—Ź Coordination â—‹ OpenGL y-axis is flipped relative to images â–  more expensive: flip bitmap when loaded â–  less expensive: flip texture coordinates â—‹ texture coordinates are called texels â—‹ (s,t) instead of (x,y) â—Ź Load image bitmap into application â—Ź Supply shaders with texture data â—Ź Shaders draw the texture
  • 14. Texture Filtering â—Ź minification & magnification â—Ź mipmapping â—Ź nearest neighbor â—‹ blocky when magnified â—Ź bilinear â—‹ smoother when magnified â—Ź trilinear â—‹ smoother when multiple levels are side by side
  • 15. Blending â—Ź effect of combining colors â—Ź OpenGL provides several modes â—‹ additive â—‹ multiplicative â—‹ interpolative â—Ź occurs in fragment shader â—‹ after calculating final color â—‹ normally overwrites previous value â—‹ blending… blends with previous value
  • 16. Vertex Buffer Objects â—Ź instead of transferring data every frame â—‹ from client memory to OpenGL â—Ź transfer once and draw from graphics cache â—Ź generate an OpenGL buffer â—‹ give it the data in the client buffer â—‹ free client memory
  • 17. Index Buffer Objects â—Ź VBO's can contain a lot of redundant data â—‹ specifically, redundant vertex data â—Ź instead, define each vertex once only in IBO â—Ź reference each vertex by index in IBO