OpenGL harness the full power of the gpu to create 2D and 3D compelling graphics in a cross-platform manner. In this session we will introduce the OpenGL fundamentals, and we will focus on creating functional OpenGL applications as well as demonstrating WebGL, which brings the OpenGL APIs into the the web world.
As presented in DroidCon Tel Aviv 2014 by:
Ziv Gilad
http://il.droidcon.com
3. First - few Examples
Few Examples from the WebGL
World:
• Trigger Rally
• Jellyfish Simulation
• Train Demo
• Mammoth
4. What is OpenGL?
• Hardware-accelerated 3D graphics
• API for rendering 2D and 3D
• Cross-language
• Multi-platform
• Part of the Khronos Group
• Royalty-free
• Client-based rendering
• Immediate mode rendering
5. Android Support
• Android uses OpenGL ES
• OpenGL ES 1.0 and 1.1
• Android 1.0 and higher
• OpenGL ES 2.0
• Android 2.2 (API level 8) and higher
• OpenGL ES 3.0
• Android 4.3 (API level 18) and higher
may support
• Requires device manufacturer support
6. WebGL for Android
• Android also supports OpenGL for
the Web
• WebGL is the OpenGL ES JavaScript APIS
• Browser Support:
• FireFox for Mobile 4
• Chrome for Android 25
• Opera Mobile 12
7. 3D Models
• Defined using meshes
• Mesh composed of triangles
• Triangles are 3 vertices
• Vertices are x, y, z triples
• No surface properties
• No color
• No Mateial
18. Cameras, Perspective,
Viewports
• Camera position and orientation
• Model – View matrix
• Field of view (FOV)
• Perspective matrix
• Viewport
• 2D projection of 3D
scene
31. Picking
• Create offscreen framebuffer
• Label objects with unique colors
• Off-screen – on screen render
• Read Pixel Data
32. Summary
• OpenGL – hardware
accelerated 3D graphics
• Vertex Shader - manipulates
per-vertex data
• Fragment Shader - calculates
color of individual pixels
• Textures display images on
the surface of geometries