OpenGL ES

The BlackBerry 10 Native SDK supports OpenGL ES versions 1.1, 2.0, and 3.0. OpenGL ES allows you to render 2-D and 3-D graphics to a device screen. The OpenGL ES APIs are bound to an Embedded Graphics Library (EGL) surface, which is bound to a native window. This binding forms a pipeline that your OpenGL ES code goes through.

Architecture: OpenGL ES in BlackBerry 10

In the BlackBerry 10 OS, OpenGL ES is used in several development frameworks, such as the Cascades UI framework, the BlackBerry 10 WebWorks SDK, and more. The following architecture diagram shows how OpenGL ES is used in each SDK:

Architecture diagram of OpenGL ES on BlackBerry 10

The BlackBerry 10 architecture is built on the QNX Neutrino RTOS. The QNX Neutrino RTOS includes a window compositor that performs various transformations on windows and blends windows together. The compositor is optimized for BlackBerry 10 and uses the graphics hardware when it's required.

The Cascades UI framework is based on Qt and exposes a set of C++ APIs for building UIs and animations. Cascades is based on a client/server architecture and uses OpenGL ES as its rendering engine. The WebKit engine powers the BlackBerry 10 WebWorks SDK and uses both the 2-D and 3-D hardware for rendering. The BlackBerry Runtime for Android apps uses the Skia 2-D engine and OpenGL ES for rendering and accelerated compositing.

Relationship between OpenGL ES and EGL

OpenGL is a multiplatform API for rendering 2-D and 3-D graphics. The API interacts with the GPU to render hardware-accelerated graphics. OpenGL is network-transparent and independent of the windowing and operating systems.

OpenGL ES is the embedded system version of the OpenGL API and is used for mobile devices and other embedded software systems. There are several versions of OpenGL ES and each version corresponds to an OpenGL version specification. For example, OpenGL ES 1.1 corresponds to OpenGL 1.5 and OpenGL ES 2.0 corresponds to OpenGL 2.0. Porting code between any two corresponding APIs is simpler than porting code between two unmatched APIs.

Standard graphics pipeline

To display an OpenGL ES model on a device, the standard graphics pipeline on BlackBerry 10 must be set up. Your OpenGL ES code is bound to an EGL surface that is bound to the Screen Graphics Subsystem. After the pipeline is set up, your OpenGL ES model is displayed on the device.

An illustration showing a basic OpenGL pipeline.

Embedded Graphics Library

The Embedded Graphics Library (EGL) is an interface API between OpenGL ES and the native windowing system on BlackBerry 10. The Screen API provides access to the native windowing system. EGL is used for graphics resource management. EGL provides mechanisms for creating rendering surfaces that OpenGL ES can draw to, while also providing graphics contexts and rendering synchronization. BlackBerry 10 currently supports EGL version 1.4. For more information on EGL, see the Khronos EGL Registry on the Khronos group website.

Native windowing system

You can access the native windowing system on BlackBerry 10 by using the Screen API. You can create windows, define window groups, set up displays, and more. EGL is bound to the Screen API to provide a rendering surface for your OpenGL ES model. For more information about the Screen API, see Screen Graphics Subsystem.

Supported versions

OpenGL ES is a 2-D and 3-D graphics API for embedded software systems that consists of a subset of the desktop OpenGL API. OpenGL ES interacts directly with the GPU to provide hardware-accelerated graphics in your app. BlackBerry 10 supports three versions of the OpenGL ES API:

OpenGL ES 1.1

OpenGL ES 1.1 uses a fixed-function rendering pipeline, which allows you to render graphics using traditional lighting and shading models. It is defined relative to the OpenGL 1.5 specification and is fully backward compatible with OpenGL ES 1.0. You can configure stages of the pipeline for specific tasks or disable stages as required.

If your graphical models are simple, you should consider OpenGL ES 1.1. Developers who are new to OpenGL may find coding in OpenGL ES 1.1 faster and more convenient.

OpenGL ES 2.0

OpenGL ES 2.0 uses a programmable rendering pipeline, which allows you to create shader and program objects as well as write vertex and fragment shaders in the OpenGL ES Shading Language. This implementation uses functions that are similar to version 1.1 but it does not support the fixed-function transformation and fragment pipeline.

OpenGL ES 2.0 is more flexible and more powerful than version 1.1. Also, the vertex and fragment calculations in version 2.0 have better performance. However, the OpenGL ES 2.0 API requires more coding, such as programming the shaders, and you need to re-create some of the pipeline that version 1.1 provides by default.

OpenGL ES 3.0

OpenGL ES 3.0 also uses a programmable rendering pipeline and adds features and improvements over version 2.0. These features include supporting new buffer formats and textures, adding occlusion queries and geometry instancing, and providing a new version of the OpenGL ES Shading Language. The new version of the OpenGL ES Shading Language supports integer and 32-bit floating point operations. The rendering pipeline has been enhanced to enable acceleration of visual effects through occlusion queries, transform feedback, and instanced rendering. ETC2/EAC texture compression is standardized, eliminating the need for different sets of textures for different platforms. OpenGL ES 3.0 is backward compatible with version 2.0.

If you are developing an app using OpenGL ES 3.0, you should be aware that OpenGL ES 3.0 requires certain hardware capabilities that may not be available on all devices. You should design your app to be backward compatible with all versions of OpenGL ES. To ensure backward compatibility, the tutorials that are provided in this guide use the OpenGL ES 1.0 and OpenGL ES 2.0 templates that are provided by the Momentics IDE for BlackBerry.

Only the BlackBerry Z30 smartphone and the BlackBerry Passport smartphone support OpenGL ES 3.0. For more information, see Graphics platform specifications and Determining capabilities and extensions.

Last modified: 2015-03-31



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus