SLIDE 2 Outline What is? vs. OpenGL Profiles and versions EGL Surfaces on Windows CE and Symbian Implementations SLIDE 3 SLIDE 4 What is? Small-footprint subset of OpenGL OpenGL is too large for embedded devices! Created with the blessing and cooperation of the OpenGL ARB July 31 st 2006 ARB handed control of OpenGL over to Khronos Powerful, low-level API with full functionality for 3D games Can do almost everything OpenGL can Available on all key platforms Software and hardware implementations available Fully extensible Enables vendor differentiation and exploration of new functionality Extensions like in OpenGL No redundancy! Convenience functions removed on mobile devices Java Applications C++ Applications Scenegraph API Game Middleware M3G (JSR 184) Engine Engines
SLIDE 5 SLIDE 6 vs. OpenGL OpenGL glbegin/glend 1 Pi Primitive ii Types all no quads & polygons Data Types float, double, int, etc float, fixed gldraw/read Pixels glreadpixels only Textures 1D, 2D, 3D, cube 2D Stencil optional Window Bindings WGL, GLX, etc EGL What was removed? (1) glbegin/glend use vertex array or vertex objects Data types No double precision floating point Use float, fixed, int, short or byte No 32-bit indices Use 16-bit or 8-bit indices Convenience functions GLU, evaluators, picking, feedback, display lists Reduced state queries Render targets No quad dbuffer, No indexed dmode No frame buffer writing (gldrawpixels, glbitmap) 1 : Except for Security Critical profile SLIDE 7 SLIDE 8 What was removed? (2) Complex, rarely used features Polygon stippling Double sided d materials 1D, 3D, cube map textures Non-low level primitives Quads, quad-strips, polygons Versions and Profiles Two major tracks Not compatible parallel rather than competitive 1.x Fixed function pipeline Suitable for software implementations (<100 KB) All 1.x backwards compatible 3 different profiles 2.x Vertex and pixel shader using GLSL ES All 2.x backwards compatible
SLIDE 9 SLIDE 10 1.x 2.x 1.0 specification released in 2003 Aimed at software implementations Used for Playstation 3 (with many extensions though) 1.1 specification released in 2004 Buffer objects Vertex skinning 1.2+ only if market requires it Profiles Common Lite (CL): fixed-point only Common (CM): fixed-point & floating point Safety Critical (SC): glbegin/glend, display lists, no texture matrix, no compressed textures Draft released in 2005 Derived from OpenGL 2.0 pipeline p No fixed function Not compatible to 1.x! Only a single profile Floating point or integer no fixed point anymore Shading language GLSL ES Two models: Online compiling (like PC): OES_shader_source Offline compiling: OES_shader_binary More burden on the application programmer SLIDE 11 SLIDE 12 Fixed Function vs. Programable Vertex Shader Transform Primitive Vertex Primitive and API Processing Shader Assembly Lighting Uniforms Textures Varying 0 Attribute 0 Varying 1 Attribute 1 Varying 2 Fog Color Sum Texture Fragment Shader Environment Rasterizer Attribute 2 Attribute 3 Vertex Shader Varying 3 Varying Attribute gl_position gl_pointsize Alpha, Depth & Stencil Tests Blending Dither Framebuffer Temporary Variables
SLIDE 13 SLIDE 14 Fragment Shader Vertex Arrays vs. Vertex Buffer Objects Vertex Arrays The way to go in 1.0 Vertex data stored in client memory Vertex Buffer Objects Added with 1.1 (as did OpenGL 1.5) Data stored in server (GPU-side) memory Faster for static geometry Vertex color, normals, tex-coords and indices Can not be read back SLIDE 15 SLIDE 16 Surface Types Selected during initialization via EGL Window surface On-screen, double buffered Fully managed (owned) by the GPU Usually not video memory access (2D blitting requires using texturing) PBuffer surface OS independent, single buffered Fully managed (owned) by the GPU PixMap surface OS dependent, single buffered Fully owned by the OS, slow, allows memory access CFbsBitmap in Symbian HBITMAP in Windows Initialization with EGL (1) NativeWindowType m_window; // = &Window() under Symbian // = CreateWindow() under WinCE EGLDisplay m_display; EGLConfig m_config; EGLContext m_context; EGLSurface m_surface; static const EGLint attrib_ list[] = EGL_RED_SIZE, 8, // 8 bit red channel EGL_GREEN_SIZE, 8, // 8 bit green channel EGL_BLUE_SIZE, 8, // 8 bit blue channel EGL_ALPHA_SIZE, EGL_DONT_CARE, // any alpha size EGL_DEPTH_SIZE, 32, // 32 bit z-buffer EGL_STENCIL_SIZE, EGL_DONT_CARE, // any stencil EGL_NONE // terminate t list
SLIDE 17 SLIDE 18 Initialization with EGL (2) Rendering with 1.x (1) void init() EGLint numconfigs, majorversion, minorversion; m_display = eglgetdisplay(egl_default_display); eglinitialize(m_display, &majorversion, &minorversion); eglgetconfigs(m_display, NULL, 0, &numconfigs); eglchooseconfig(m_display, attrib_list, &m_config, 1, &numconfigs); m_context = eglcreatecontext(m_display, m_config, NULL, NULL); m_surface = eglcreatewindowsurface(m_display,m_config,m_window,null); eglmakecurrent(m_display, m_surface, m_surface, m_context); void deinit() eglmakecurrent(m_display, NULL, NULL, NULL); egldestroycontext(m_display, m_context); egldestroysurface(m_display, m_surface); eglterminate(m_display); const GLbyte vertices[] = -10, 10, 10, 10, -10, 10, 10, 10, 10, -10, -10, 10, -10, 10, -10, 10, -10, -10, 10, 10, -10, -10, -10, -10 const GLubyte indices[] = 0, 3, 1, 2, 0, 1, 6, 5, 4, 5, 7, 4, 4, 7, 3, 0, 4, 3, 2, 1, 5, 6, 2, 5, 4, 0, 2, 6, 4, 2, 3, 7, 1, 7, 5, 1 const GLbyte normals[] = -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1 taken from Rasteroid sample code SLIDE 19 SLIDE 20 Rendering with 1.x (2) void render() glclearcolor(0.1f, 0.2f, 0.4f, 0.f); glclear(gl_color_buffer_bit); glenableclientstate(gl_vertex_array); glvertexpointer(3, GL_BYTE, 0, vertices); glenableclientstate(gl_normal_array); glnormalpointer(gl_byte, 0, normals); glmatrixmode(gl_modelview); glloadidentity(); gltranslatef(0.f, 0.f, -50.f); glrotatef(45.0f, 1.0f, 0.0f, 0f -1.0f); gldrawelements(gl_triangles, 36, GL_UNSIGNED_BYTE, indices); eglswapbuffers(m_display, m_surface); taken from Rasteroid sample code Rendering with fixed point Fixed point counterparts for every floating point function gllightf() gllightx() glmaterialfv() glmaterialxv() glclearcolor() glclearcolorx() #define INT2FIXED(x) ((x)<<16) #define FLOAT2FIXED(x) ((int)((f)*65536.0f)) #define EGL_ONE (1<<16) void render() glclearcolorx(1<<16, 0, 0, 0); glclear(gl_color_buffer_bit); gltranslatex(0 0 INT2FIXED(100)); gltranslatex(0, 0, -INT2FIXED(100)); glrotatex(float2fixed(12.3f), 0, 0, -EGL_ONE);
SLIDE 21 SLIDE 22 Software Implementations All implementations only cover version 1.x! NokiaGL Just for Nokia devices Rasteroid from Hybrid Free for non-commercial use http://www.hybrid.fi Vincent Open source implementation http://sourceforge.net/projects/ogl-es Reference implementation Wraps OpenGL Only for PC development Hardware Implementations Intel 2700G Addon processor for XScale, based on PowerVR MBX Used in Dell Axim X50v, Samsung M7000 SH-Mobile3 Based on PowerVR MBX Used in Fujsitsu F902i, Mitsubishi D902i TI OMAP2420 ARM CPU with 3D rendering extension Based on PowerVR MBX Used in Nokia N93 & N95, Sharp SH902, Sony Ericsson SO902i, NEC 902i, Panasonic P902i Philips Nexperia PNX4008 Used in Sony Ericsson W950, M600 & P990 ATI Imageon Series NVIDIA Goforce Series Used in Gizmondo, O2 XDA Flame