SlideShare una empresa de Scribd logo
1 de 24
RENDERING TARGETS
2014RENDERING TARGETS
 A rendering context is required before drawing a scene. And a correponding
Framebuffer
 Recall bindFramebuffer()
 It can be
 Window system Framebuffer (Fb)
 Offscreen buffer (Implemented in a Frame Buffer Object)
 FBO is not a memory area – it is information about the actual color buffer in
memory, depth/ stencil buffers
 By default, rendering happens to the Window system framebuffer (ID ‘0’)
Need
2014NEED FOR OFFSCREEN RENDERING
 Special effects
 Refer the fire effect specified earlier (Multiple passes)
 Interfacing to “non-display” use-cases
 Ex, passing video through GPU, perform 3D effects, then re-encode back to
compressed format
 Edge detection/ computation – output is sent to a memory buffer for use by other
(non-GL) engines
FBO
2014FRAMEBUFFER OBJECT
 A Frame Buffer Object
 Can be just a color buffer (ex, a buffer of size 1920x1080x 4)
 Typically also has depth/ stencil buffer
 By default – FBO – ID “0” is never assigned to new FBO
 It is assigned to Window system provided Frame Buffer (onscreen)
 Renderbuffers and Textures can be “attached” to FBO
 For RB – application has to allocate storage
 For FBO, the GL server will allocate the storage
rtt
2014RENDER-TO-TEXTURE
 By binding a Texture to a FBO, the FBO can be used as
 Stage 1 – target of a rendering operation
 Stage 2 – used as a texture to another draw
 This is “Render-To-Texture” (RTT)
 This allows the flexibility of “discreetly” using the server to do 3D operations (not
visible onscreen), then use this output as texture input to a visible object
 If not for RTT, we have to render to regular Framebuffer then do CopyTexImage2D()
or readPixels() which are inefficient
 Offscreen rendering is needed for dynamic-reflections
APIs
2014POST-PROCESSING OPERATIONS
 Blending with Framebuffer - enables nice effects (Ref Lab #6)
 Standard Alpha-Blending
 glEnable ( GL_BLEND );
 glBlendFunc ( GL_SRC_ALPHA, GL_ONE );
 Is a “bad” way of creating effects
 Reads back previous framebuffer contents, then blend
 Makes application memory bound, specially at larger resolutions
 Stalls parallel operations within the GPU
 Recommended way is to perform Render-To-Texture, and blending where
necessary in the shader
 But needed for medical image viewing – ex Ultrasound images, > 128 slices
blending
programming
PROGRAMMING FBO AND ONSCREEN
 glGenFramebuffers
 glBindFramebuffer
 Makes this FBO used
 glFramebufferTexture2D(id)
 Indicate ‘id’ is to be used for rendering to
TEXTURE, so storage is different
 glDeleteFramebuffers
 Then, create separate object to texture with
TEXTURE ‘id’
 Then, use previous textureID id as input to
texImage2D next
 Switching to on-screen
 Change binding to screen FB
 Load different set of vertices as needed,
different program as needed
 Set texture binding to FBO texture drawn
previously
 DrawElements call
 FBOs are used to do post-processing effects
PROGRAMMING
 Clear the current screen to a
FBO off-screen, with a color
 Using this FBO as RGB texture
input, render another rectangle
on-screen
 “CheckFramebufferStatus()” -
very important
 Lab Exercise
2014LAB L5 – RENDER TO TEXTURE
OPENGL TO GLES 2
2014
CONSIDERING THE GL TO GLES
MOVEMENT
 Ensure display lists are not used
 Convert polygons to triangles/ lines
 Check for missing extensions, shaders and rendering modes
 Ex, shader language
 Ex, 3D Texture (This is added in GL ES3.0) – Ultrasound image rendering
 Performance:
 Immediate, and Tile based-Deferred
 Streaming textures
 Use specific extensions – ex eglImage
 Do not use glTexImage2D
 Find out bottlenecks through profiling – CPU or GPU ? 11
PLATFORM INTEGRATION
2014SETTING UP THE PLATFORM - EGL
 Context, Window, Surface
 Refer to sgxperf - link
 OpenGL ES –
 EGL_SWAP_BEHAVIOR == “EGL_BUFFER_PRESERVED”
 Reduces performance
 Anti-aliasing configurations
 EGL_SAMPLES (4 to 16 typically, 4 on embedded platforms)
 WebGL - preserveDrawingBuffer – attribute
 Optimisations done if it is known that app is clearing the buffer – no dirty region check
and whole scene is drawn efficiently
 Dirty region check made in some systems
Android
2014ANDROID INTEGRATION DETAILS
 Android composition uses GLES2.0 mostly as a pixel processor, not a vertex
processor
 Uninteresting rectangular windows, treated as a texture
 6 vertices
 Blending of translucent screens/ buttons/ text
 3D (GLES2.0) is natively integrated
 3D Live wallpaper backgrounds
 Video morphing during conferencing (?)
 Use the NDK
Surfaceflinger
2014
ANDROID SURFACEFLINGER
ARCHITECTURE
 Introduction to OpenGL interface on Android
 http://code.google.com/p/gdc2011-android-opengl/wiki/TalkTranscript
 HW acceleration on Android 3.0 / 4.x
 http://android-developers.blogspot.com/2011/11/android-40-graphics-and-
animations.html
composition
2014
HOW ANDROID ACCELERATES
COMPOSITION
 Indirectly, using window surfaces as textures
 eglImage extensions allow direct usage
 Rather than texImage2D
 Understand overheads of texImage2D for live images
 Below picture from IMGTECH website shows
the stack
3D
2014
HOW ANDROID ACCELERATES 3D
OPERATIONS
 Directly
 Java wrappers (bindings) provided for GLES20 APIs, for the Java application
writer
 Not all APIs
 Every API level includes more and more number of API coverage
 3D rendering gets drawn to an Android “surface”
 Then gets “composited” with other elements, before display on final screen
 http://code.google.com/p/android-native-egl-
example/source/browse/jni/renderer.cpp iOS
2014IOS INTERFACE
 Creating an application using Xcode
 http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iPhone101/A
rticles/00_Introduction.html#//apple_ref/doc/uid/TP40007514-CH1-SW1
 GL Platform integration quite different from Android
 http://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenG
LES_ProgrammingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP400087
93-CH1-SW1
 Lot of Apple specific extensions – ex MSAA
pixmaps
2014PIXMAPS
 EGL does not specify multi-process operation
 Pixmap - A critical component in systems for composition with multiple
processes / shared memory
 EGL_KHR_image_pixmap
 http://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_image_pixmap.txt
 This is used for getting output from multiple processes as textures, and then
used by composition manager to show the composited final desktop with
blending enabled
 Accelerated with openGL / ES
 Used in Android, Xorg …. Qt
2014QT INTERFACE
 How frameworks use 3D engine for blitting, composition work
 Qt + powervr display plugin (Qt4 only)
 Qt5 + eglfs or Qt + Wayland
 GraphicsSystem
optimising
2014OPTIMISING OPENGL / ES APPLICATIONS
 Graphics performance is closely tied to a specific HW
 Size of interface to memory, cache lines
 HW shared with CPU – ex, dedicated memory banks
 Power vs Raw performance
 Intelligent Discarding of vertices/ objects (!)
 Performance is typically limited by
 Memory throughput
 GPU pixel operations per GPU clock
 CPU throughput for operations involving vertices
 Load balancing of units – within the GPU
 GPUs that are integrated into SOCs are closely tied to the CPU for operations, than discrete GPUs
 Ex, GPU drivers offload some operations to CPU
debugging
2014DEBUGGING OPENGL
 Vanishing vertices, Holes
 Improper lighting
 Missing objects in complex scenes
 Android Tools
 systrace with GPU tracing enabled (http://developer.android.com/tools/debugging/systrace.html)
 Windows Tools
 PerfHUD ES
 Perfkit/ GLExpert / gDEBugger
 Intel GPA
 Linux Tools
 PVRTune (IMG)
 GDebugger
 Standard kernel tools
 Intel GPA
 Pixel vs Vertex throughput, CPU loading, FPS, Memory limited – tuning knobs
2014REFERENCES
 Specs - http://khronos.org/opengles
 CanvasMatrix.js
 https://github.com/toji/gl-matrix
 Tools - http://www.iquilezles.org/apps/shadertoy/
 http://www.inka3d.com/ (from Maya)
 http://assimp.sourceforge.net/ - Asset importer
 ARM – Mali – Architecture Recommendations
 http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0363d/CJAFCCDE.html
 Optimising games – simple tips
 http://glenncorpes.blogspot.com/2011/09/topia-optimising-for-opengles20.html
2014APPENDIX: VIDEO AND GRAPHICS
 Graphics is computed creation
 Video is recorded as-is
 Graphics is object – based
 Video (today) is not
 Graphics is computed every frame fully
 Video is mostly delta sequences
 Motion-detection, construction, compensation
 But extensions like swap_region (Nokia) exist

Más contenido relacionado

La actualidad más candente

Connecting C++ and JavaScript on the Web with Embind
Connecting C++ and JavaScript on the Web with EmbindConnecting C++ and JavaScript on the Web with Embind
Connecting C++ and JavaScript on the Web with Embind
Chad Austin
 

La actualidad más candente (20)

Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Go lang
Go langGo lang
Go lang
 
EGL 1.4 Reference Card
EGL 1.4 Reference CardEGL 1.4 Reference Card
EGL 1.4 Reference Card
 
WebGL 2.0 Reference Guide
WebGL 2.0 Reference GuideWebGL 2.0 Reference Guide
WebGL 2.0 Reference Guide
 
Gitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitGitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for Git
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Vertex Shader Tricks by Bill Bilodeau - AMD at GDC14
Vertex Shader Tricks by Bill Bilodeau - AMD at GDC14Vertex Shader Tricks by Bill Bilodeau - AMD at GDC14
Vertex Shader Tricks by Bill Bilodeau - AMD at GDC14
 
Introduction to gRPC
Introduction to gRPCIntroduction to gRPC
Introduction to gRPC
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
OpenGL ES 3.2 Reference Guide
OpenGL ES 3.2 Reference GuideOpenGL ES 3.2 Reference Guide
OpenGL ES 3.2 Reference Guide
 
JSON 데이터를 DB에 넣고 사용하고 싶다
JSON 데이터를 DB에 넣고 사용하고 싶다JSON 데이터를 DB에 넣고 사용하고 싶다
JSON 데이터를 DB에 넣고 사용하고 싶다
 
NVIDIA OpenGL 4.6 in 2017
NVIDIA OpenGL 4.6 in 2017NVIDIA OpenGL 4.6 in 2017
NVIDIA OpenGL 4.6 in 2017
 
Html5 notes for professionals
Html5 notes for professionalsHtml5 notes for professionals
Html5 notes for professionals
 
Implementing DDD with C#
Implementing DDD with C#Implementing DDD with C#
Implementing DDD with C#
 
Introduction to TypeScript
Introduction to TypeScriptIntroduction to TypeScript
Introduction to TypeScript
 
Connecting C++ and JavaScript on the Web with Embind
Connecting C++ and JavaScript on the Web with EmbindConnecting C++ and JavaScript on the Web with Embind
Connecting C++ and JavaScript on the Web with Embind
 
[Android] Web services
[Android] Web services[Android] Web services
[Android] Web services
 
Grapics debugging with RenderDoc
Grapics debugging with RenderDocGrapics debugging with RenderDoc
Grapics debugging with RenderDoc
 
React js
React jsReact js
React js
 
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
 

Destacado

Destacado (12)

GFX Part 5 - Introduction to Object Transformations in OpenGL ES
GFX Part 5 - Introduction to Object Transformations in OpenGL ESGFX Part 5 - Introduction to Object Transformations in OpenGL ES
GFX Part 5 - Introduction to Object Transformations in OpenGL ES
 
Technology, Innovation - A Perspective
Technology, Innovation - A PerspectiveTechnology, Innovation - A Perspective
Technology, Innovation - A Perspective
 
GFX Part 1 - Introduction to GPU HW and OpenGL ES specifications
GFX Part 1 - Introduction to GPU HW and OpenGL ES specificationsGFX Part 1 - Introduction to GPU HW and OpenGL ES specifications
GFX Part 1 - Introduction to GPU HW and OpenGL ES specifications
 
ONscreen vs. OFFscreen rendering v iOS - For-Mobile 3/2013
ONscreen vs. OFFscreen rendering v iOS - For-Mobile 3/2013ONscreen vs. OFFscreen rendering v iOS - For-Mobile 3/2013
ONscreen vs. OFFscreen rendering v iOS - For-Mobile 3/2013
 
GFX Part 6 - Introduction to Vertex and Fragment Shaders in OpenGL ES
GFX Part 6 - Introduction to Vertex and Fragment Shaders in OpenGL ESGFX Part 6 - Introduction to Vertex and Fragment Shaders in OpenGL ES
GFX Part 6 - Introduction to Vertex and Fragment Shaders in OpenGL ES
 
John Carmack talk at SMU, April 2014 - Virtual Reality
John Carmack talk at SMU, April 2014 - Virtual RealityJohn Carmack talk at SMU, April 2014 - Virtual Reality
John Carmack talk at SMU, April 2014 - Virtual Reality
 
GFX Part 4 - Introduction to Texturing in OpenGL ES
GFX Part 4 - Introduction to Texturing in OpenGL ESGFX Part 4 - Introduction to Texturing in OpenGL ES
GFX Part 4 - Introduction to Texturing in OpenGL ES
 
GFX Part 3 - Vertices and interactions in OpenGL
GFX Part 3 - Vertices and interactions in OpenGLGFX Part 3 - Vertices and interactions in OpenGL
GFX Part 3 - Vertices and interactions in OpenGL
 
GFX part 8 - Three.js introduction and usage
GFX part 8 - Three.js introduction and usageGFX part 8 - Three.js introduction and usage
GFX part 8 - Three.js introduction and usage
 
Open Shading Language (OSL)
Open Shading Language (OSL)Open Shading Language (OSL)
Open Shading Language (OSL)
 
GFX Part 2 - Introduction to GPU Programming
GFX Part 2 - Introduction to GPU ProgrammingGFX Part 2 - Introduction to GPU Programming
GFX Part 2 - Introduction to GPU Programming
 
IEEE - Consumer Electronics Trends Opportunities (2015)
IEEE - Consumer Electronics Trends Opportunities (2015)IEEE - Consumer Electronics Trends Opportunities (2015)
IEEE - Consumer Electronics Trends Opportunities (2015)
 

Similar a GFX Part 7 - Introduction to Rendering Targets in OpenGL ES

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
changehee lee
 
VisionizeBeforeVisulaize_IEVC_Final
VisionizeBeforeVisulaize_IEVC_FinalVisionizeBeforeVisulaize_IEVC_Final
VisionizeBeforeVisulaize_IEVC_Final
Masatsugu HASHIMOTO
 

Similar a GFX Part 7 - Introduction to Rendering Targets in OpenGL ES (20)

Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011
 
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
 
Well Behaved Mobile Apps on AIR - Performance Related
Well Behaved Mobile Apps on AIR - Performance RelatedWell Behaved Mobile Apps on AIR - Performance Related
Well Behaved Mobile Apps on AIR - Performance Related
 
OpenGL 4 for 2010
OpenGL 4 for 2010OpenGL 4 for 2010
OpenGL 4 for 2010
 
NVIDIA's OpenGL Functionality
NVIDIA's OpenGL FunctionalityNVIDIA's OpenGL Functionality
NVIDIA's OpenGL Functionality
 
Introduction to 2D/3D Graphics
Introduction to 2D/3D GraphicsIntroduction to 2D/3D Graphics
Introduction to 2D/3D Graphics
 
Adobe MAX Recap
Adobe MAX RecapAdobe MAX Recap
Adobe MAX Recap
 
Creative Coders March 2013 - Introducing Starling Framework
Creative Coders March 2013 - Introducing Starling FrameworkCreative Coders March 2013 - Introducing Starling Framework
Creative Coders March 2013 - Introducing Starling Framework
 
FrameGraph: Extensible Rendering Architecture in Frostbite
FrameGraph: Extensible Rendering Architecture in FrostbiteFrameGraph: Extensible Rendering Architecture in Frostbite
FrameGraph: Extensible Rendering Architecture in Frostbite
 
Open gl
Open glOpen gl
Open gl
 
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
 
Sig13 ce future_gfx
Sig13 ce future_gfxSig13 ce future_gfx
Sig13 ce future_gfx
 
JIT Spraying Never Dies - Bypass CFG By Leveraging WARP Shader JIT Spraying.pdf
JIT Spraying Never Dies - Bypass CFG By Leveraging WARP Shader JIT Spraying.pdfJIT Spraying Never Dies - Bypass CFG By Leveraging WARP Shader JIT Spraying.pdf
JIT Spraying Never Dies - Bypass CFG By Leveraging WARP Shader JIT Spraying.pdf
 
Android native gl
Android native glAndroid native gl
Android native gl
 
VisionizeBeforeVisulaize_IEVC_Final
VisionizeBeforeVisulaize_IEVC_FinalVisionizeBeforeVisulaize_IEVC_Final
VisionizeBeforeVisulaize_IEVC_Final
 
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
 
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
Opengl basicsOpengl basics
Opengl basics
 
[Unite Seoul 2019] Mali GPU Architecture and Mobile Studio
[Unite Seoul 2019] Mali GPU Architecture and Mobile Studio [Unite Seoul 2019] Mali GPU Architecture and Mobile Studio
[Unite Seoul 2019] Mali GPU Architecture and Mobile Studio
 
Computer graphics workbook
Computer graphics workbookComputer graphics workbook
Computer graphics workbook
 

Más de Prabindh Sundareson

Más de Prabindh Sundareson (19)

Synthetic Data and Graphics Techniques in Robotics
Synthetic Data and Graphics Techniques in RoboticsSynthetic Data and Graphics Techniques in Robotics
Synthetic Data and Graphics Techniques in Robotics
 
Work and Life
Work and Life Work and Life
Work and Life
 
GPU Algorithms and trends 2018
GPU Algorithms and trends 2018GPU Algorithms and trends 2018
GPU Algorithms and trends 2018
 
Machine learning in the Indian Context - IEEE talk at SRM Institute
Machine learning in the Indian Context - IEEE talk at SRM InstituteMachine learning in the Indian Context - IEEE talk at SRM Institute
Machine learning in the Indian Context - IEEE talk at SRM Institute
 
Students Hackathon - 2017
Students Hackathon - 2017Students Hackathon - 2017
Students Hackathon - 2017
 
ICCE Asia 2017 - Program Outline
ICCE Asia 2017 - Program OutlineICCE Asia 2017 - Program Outline
ICCE Asia 2017 - Program Outline
 
Call for Papers - ICCE Asia 2017
Call for Papers - ICCE Asia 2017Call for Papers - ICCE Asia 2017
Call for Papers - ICCE Asia 2017
 
GFX2014 OpenGL ES Quiz
GFX2014 OpenGL ES QuizGFX2014 OpenGL ES Quiz
GFX2014 OpenGL ES Quiz
 
Gfx2014 Graphics Workshop - Lab manual
Gfx2014 Graphics Workshop - Lab manualGfx2014 Graphics Workshop - Lab manual
Gfx2014 Graphics Workshop - Lab manual
 
Render to Texture with Three.js
Render to Texture with Three.jsRender to Texture with Three.js
Render to Texture with Three.js
 
ANGLE on Windows for OpenGLES2.0
ANGLE on Windows for OpenGLES2.0ANGLE on Windows for OpenGLES2.0
ANGLE on Windows for OpenGLES2.0
 
Yocto usage for Graphics SDK on AM335x
Yocto usage for Graphics SDK on AM335xYocto usage for Graphics SDK on AM335x
Yocto usage for Graphics SDK on AM335x
 
Gfx2013 lab manual
Gfx2013 lab manualGfx2013 lab manual
Gfx2013 lab manual
 
ARM Linux Embedded memory protection techniques
ARM Linux Embedded memory protection techniquesARM Linux Embedded memory protection techniques
ARM Linux Embedded memory protection techniques
 
Qt5 (minimal) on beaglebone, with Yocto
Qt5 (minimal) on beaglebone, with YoctoQt5 (minimal) on beaglebone, with Yocto
Qt5 (minimal) on beaglebone, with Yocto
 
Moksha - HTML5/CSS with Qt5+Snowshoe on AM335x
Moksha - HTML5/CSS with Qt5+Snowshoe on AM335xMoksha - HTML5/CSS with Qt5+Snowshoe on AM335x
Moksha - HTML5/CSS with Qt5+Snowshoe on AM335x
 
Qt5.0.0 eglfs abort issue
Qt5.0.0 eglfs abort issueQt5.0.0 eglfs abort issue
Qt5.0.0 eglfs abort issue
 
Cache profiling on ARM Linux
Cache profiling on ARM LinuxCache profiling on ARM Linux
Cache profiling on ARM Linux
 
Qt5 beta1 on ti platforms
Qt5 beta1 on ti platformsQt5 beta1 on ti platforms
Qt5 beta1 on ti platforms
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

GFX Part 7 - Introduction to Rendering Targets in OpenGL ES

  • 2. 2014RENDERING TARGETS  A rendering context is required before drawing a scene. And a correponding Framebuffer  Recall bindFramebuffer()  It can be  Window system Framebuffer (Fb)  Offscreen buffer (Implemented in a Frame Buffer Object)  FBO is not a memory area – it is information about the actual color buffer in memory, depth/ stencil buffers  By default, rendering happens to the Window system framebuffer (ID ‘0’) Need
  • 3. 2014NEED FOR OFFSCREEN RENDERING  Special effects  Refer the fire effect specified earlier (Multiple passes)  Interfacing to “non-display” use-cases  Ex, passing video through GPU, perform 3D effects, then re-encode back to compressed format  Edge detection/ computation – output is sent to a memory buffer for use by other (non-GL) engines FBO
  • 4. 2014FRAMEBUFFER OBJECT  A Frame Buffer Object  Can be just a color buffer (ex, a buffer of size 1920x1080x 4)  Typically also has depth/ stencil buffer  By default – FBO – ID “0” is never assigned to new FBO  It is assigned to Window system provided Frame Buffer (onscreen)  Renderbuffers and Textures can be “attached” to FBO  For RB – application has to allocate storage  For FBO, the GL server will allocate the storage rtt
  • 5. 2014RENDER-TO-TEXTURE  By binding a Texture to a FBO, the FBO can be used as  Stage 1 – target of a rendering operation  Stage 2 – used as a texture to another draw  This is “Render-To-Texture” (RTT)  This allows the flexibility of “discreetly” using the server to do 3D operations (not visible onscreen), then use this output as texture input to a visible object  If not for RTT, we have to render to regular Framebuffer then do CopyTexImage2D() or readPixels() which are inefficient  Offscreen rendering is needed for dynamic-reflections APIs
  • 6. 2014POST-PROCESSING OPERATIONS  Blending with Framebuffer - enables nice effects (Ref Lab #6)  Standard Alpha-Blending  glEnable ( GL_BLEND );  glBlendFunc ( GL_SRC_ALPHA, GL_ONE );  Is a “bad” way of creating effects  Reads back previous framebuffer contents, then blend  Makes application memory bound, specially at larger resolutions  Stalls parallel operations within the GPU  Recommended way is to perform Render-To-Texture, and blending where necessary in the shader  But needed for medical image viewing – ex Ultrasound images, > 128 slices blending programming
  • 7. PROGRAMMING FBO AND ONSCREEN  glGenFramebuffers  glBindFramebuffer  Makes this FBO used  glFramebufferTexture2D(id)  Indicate ‘id’ is to be used for rendering to TEXTURE, so storage is different  glDeleteFramebuffers  Then, create separate object to texture with TEXTURE ‘id’  Then, use previous textureID id as input to texImage2D next  Switching to on-screen  Change binding to screen FB  Load different set of vertices as needed, different program as needed  Set texture binding to FBO texture drawn previously  DrawElements call  FBOs are used to do post-processing effects
  • 8. PROGRAMMING  Clear the current screen to a FBO off-screen, with a color  Using this FBO as RGB texture input, render another rectangle on-screen  “CheckFramebufferStatus()” - very important  Lab Exercise
  • 9. 2014LAB L5 – RENDER TO TEXTURE
  • 11. 2014 CONSIDERING THE GL TO GLES MOVEMENT  Ensure display lists are not used  Convert polygons to triangles/ lines  Check for missing extensions, shaders and rendering modes  Ex, shader language  Ex, 3D Texture (This is added in GL ES3.0) – Ultrasound image rendering  Performance:  Immediate, and Tile based-Deferred  Streaming textures  Use specific extensions – ex eglImage  Do not use glTexImage2D  Find out bottlenecks through profiling – CPU or GPU ? 11
  • 13. 2014SETTING UP THE PLATFORM - EGL  Context, Window, Surface  Refer to sgxperf - link  OpenGL ES –  EGL_SWAP_BEHAVIOR == “EGL_BUFFER_PRESERVED”  Reduces performance  Anti-aliasing configurations  EGL_SAMPLES (4 to 16 typically, 4 on embedded platforms)  WebGL - preserveDrawingBuffer – attribute  Optimisations done if it is known that app is clearing the buffer – no dirty region check and whole scene is drawn efficiently  Dirty region check made in some systems Android
  • 14. 2014ANDROID INTEGRATION DETAILS  Android composition uses GLES2.0 mostly as a pixel processor, not a vertex processor  Uninteresting rectangular windows, treated as a texture  6 vertices  Blending of translucent screens/ buttons/ text  3D (GLES2.0) is natively integrated  3D Live wallpaper backgrounds  Video morphing during conferencing (?)  Use the NDK Surfaceflinger
  • 15. 2014 ANDROID SURFACEFLINGER ARCHITECTURE  Introduction to OpenGL interface on Android  http://code.google.com/p/gdc2011-android-opengl/wiki/TalkTranscript  HW acceleration on Android 3.0 / 4.x  http://android-developers.blogspot.com/2011/11/android-40-graphics-and- animations.html composition
  • 16. 2014 HOW ANDROID ACCELERATES COMPOSITION  Indirectly, using window surfaces as textures  eglImage extensions allow direct usage  Rather than texImage2D  Understand overheads of texImage2D for live images  Below picture from IMGTECH website shows the stack 3D
  • 17. 2014 HOW ANDROID ACCELERATES 3D OPERATIONS  Directly  Java wrappers (bindings) provided for GLES20 APIs, for the Java application writer  Not all APIs  Every API level includes more and more number of API coverage  3D rendering gets drawn to an Android “surface”  Then gets “composited” with other elements, before display on final screen  http://code.google.com/p/android-native-egl- example/source/browse/jni/renderer.cpp iOS
  • 18. 2014IOS INTERFACE  Creating an application using Xcode  http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iPhone101/A rticles/00_Introduction.html#//apple_ref/doc/uid/TP40007514-CH1-SW1  GL Platform integration quite different from Android  http://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenG LES_ProgrammingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP400087 93-CH1-SW1  Lot of Apple specific extensions – ex MSAA pixmaps
  • 19. 2014PIXMAPS  EGL does not specify multi-process operation  Pixmap - A critical component in systems for composition with multiple processes / shared memory  EGL_KHR_image_pixmap  http://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_image_pixmap.txt  This is used for getting output from multiple processes as textures, and then used by composition manager to show the composited final desktop with blending enabled  Accelerated with openGL / ES  Used in Android, Xorg …. Qt
  • 20. 2014QT INTERFACE  How frameworks use 3D engine for blitting, composition work  Qt + powervr display plugin (Qt4 only)  Qt5 + eglfs or Qt + Wayland  GraphicsSystem optimising
  • 21. 2014OPTIMISING OPENGL / ES APPLICATIONS  Graphics performance is closely tied to a specific HW  Size of interface to memory, cache lines  HW shared with CPU – ex, dedicated memory banks  Power vs Raw performance  Intelligent Discarding of vertices/ objects (!)  Performance is typically limited by  Memory throughput  GPU pixel operations per GPU clock  CPU throughput for operations involving vertices  Load balancing of units – within the GPU  GPUs that are integrated into SOCs are closely tied to the CPU for operations, than discrete GPUs  Ex, GPU drivers offload some operations to CPU debugging
  • 22. 2014DEBUGGING OPENGL  Vanishing vertices, Holes  Improper lighting  Missing objects in complex scenes  Android Tools  systrace with GPU tracing enabled (http://developer.android.com/tools/debugging/systrace.html)  Windows Tools  PerfHUD ES  Perfkit/ GLExpert / gDEBugger  Intel GPA  Linux Tools  PVRTune (IMG)  GDebugger  Standard kernel tools  Intel GPA  Pixel vs Vertex throughput, CPU loading, FPS, Memory limited – tuning knobs
  • 23. 2014REFERENCES  Specs - http://khronos.org/opengles  CanvasMatrix.js  https://github.com/toji/gl-matrix  Tools - http://www.iquilezles.org/apps/shadertoy/  http://www.inka3d.com/ (from Maya)  http://assimp.sourceforge.net/ - Asset importer  ARM – Mali – Architecture Recommendations  http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0363d/CJAFCCDE.html  Optimising games – simple tips  http://glenncorpes.blogspot.com/2011/09/topia-optimising-for-opengles20.html
  • 24. 2014APPENDIX: VIDEO AND GRAPHICS  Graphics is computed creation  Video is recorded as-is  Graphics is object – based  Video (today) is not  Graphics is computed every frame fully  Video is mostly delta sequences  Motion-detection, construction, compensation  But extensions like swap_region (Nokia) exist