1 / 17

Lecture 8 - OpenGL on Android

Lecture 8 - OpenGL on Android. OpenGL ES. Cut down version of OpenGL Fixed point support Found in many mobile platforms (Android, iOS , Blackberry, Symbian , 3DS, etc.) Designed for slower GPUs and CPUs. Version 1.x.

mahina
Download Presentation

Lecture 8 - OpenGL on Android

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 8 - OpenGL on Android

  2. OpenGL ES Cut down version of OpenGL Fixed point support Found in many mobile platforms (Android, iOS, Blackberry, Symbian, 3DS, etc.) Designed for slower GPUs and CPUs

  3. Version 1.x OpenGL ES 1.0 based on OpenGL 1.3 and OpenGL ES 1.1 based on OpenGL 1.5 Common and Common-Lite (only fixed point) profile Fixed-function rendering pipeline Reduced features: no quad and polygon primitives, no stippling, only multisample AA, reduced drawing modes, no display lists, etc. OpenGL ES 1.1 adds better multitexture support, VBOs, clip planes, mipmap generation Android 1.0 and higher

  4. Version 2.0 Based on OpenGL 2.0, but reduced fixed-function pipeline support Not compatible with OpenGL ES 1.x OpenGL ES Shading Language ESSL only has forward branches and fixed iteration loops Transforming and Lighting functions replaced by shaders Better performance than OpenGL ES 1.x in many cases Android 2.2 and higher

  5. Version 3.0 Compatible with OpenGL ES 2.0 and OpenGL 4.3 Standardized texture compression Better texturing support New Shading Language version with full support for integer and floating point Improved flow control Easier portability Android 4.3 and higher

  6. GL Surface Manages a surface (a region of memory which can be displayed on screen) Manages an EGL display (an OpenGL rendering context) Dedicated rendering thread Can provide debug information

  7. EGL Virtual display which contains a rendering context 2D and 3D rendering Allows having multiple smaller surfaces on the actual screen or drawing to offscreen buffer Used by SurfaceFlinger and other compositors (Wayland, Mir) or libraries (SDL)

  8. Demo private void init(boolean translucent, int depth, int stencil) { setEGLContextFactory(newContextFactory()); setEGLConfigChooser( translucent ? newConfigChooser(8, 8, 8, 8, depth, stencil) : newConfigChooser(5, 6, 5, 0, depth, stencil) ); setRenderer(new Renderer()); } Create GL2JNIView and set it as a view for the activity Constructor initializes the view

  9. Demo publicEGLConfigchooseConfig(EGL10 egl, EGLDisplay display) { /* Get the number of minimally matching EGL configurations */ int[] num_config = newint[1]; egl.eglChooseConfig(display, s_configAttribs2, null, 0, num_config); intnumConfigs = num_config[0]; /* Allocate then read the array of minimally matching EGL configs */ EGLConfig[] configs = newEGLConfig[numConfigs]; egl.eglChooseConfig(display, s_configAttribs2, configs, numConfigs, num_config); /* Now return the "best" one (matches rgba specifications) */ returnchooseConfig(egl, display, configs); }

  10. Demo private static class Renderer implementsGLSurfaceView.Renderer { public void onDrawFrame(GL10 gl) { GL2JNILib.step(); } public void onSurfaceChanged(GL10 gl, int width, int height) { GL2JNILib.init(width, height); } public void onSurfaceCreated(GL10 gl, EGLConfigconfig) { // Do nothing. } }

  11. Demo • setupGraphics • Compiles vertex and pixel shaders into a program • Defines Uniforms, Attributes, etc. • Sets initial camera position and viewport

  12. Demo • renderFrame • Updates camera • Sets shader program • Sets Uniforms and Attributes for current frame • Draws triangles

  13. Android Tools for Debugging and Profiling Logging Debugging Developer Options: Overdraw, Clipping Profiling Developer Options: Performance metrics on screen or through ADB, Traces Tracer for OpenGL ES: Visualize traces

  14. Intel GPA Intel Atom processors More information: GPU, CPU, Battery usage More detailed analysis Identifies possible bottlenecks Realtime Works over Wifi

  15. Vendor specific tools Low level information Different interface and capabilities for each vendor Optimizations not always portable PowerVR, Tegra, Adreno, etc.

  16. Bibliography https://www.khronos.org/opengles/ http://developer.android.com/guide/topics/graphics/opengl.html http://developer.android.com/training/graphics/opengl/index.html

  17. Keywords OpenGL EGL Fixed function pipeline Shaders GLSurfaceView Profiling Tracer

More Related