3.2.2. OpenGL ES emulator integration

This section describes:


The OpenGL ES emulator contains two libraries corresponding to the separate OpenGL ES 2.0 and EGL 1.3 APIs.

For convenience, the OpenGL ES emulator also includes the files required for Open GL ES 1.1. If you are building OpenGL ES 1.1 applications, you must include libGLESv1_CM.so instead of libGLESv2.so.

Table 3.1 shows the libraries for OpenGL ES 2.0 emulation:

Table 3.1. OpenGL ES emulator library structure

bin/libGLESv2.soLibrary for OpenGL ES 2.0 emulator
bin/libEGL.soLibrary for EGL API
bin/libGLESv1_CM.soLibrary for OpenGL ES 1.1 emulator

EGL configuration

The EGL library supplied with the OpenGL ES Emulator supports OpenGL ES 2.0 and OpenGL ES 1.1.


Ensure that, in the OpenGL ES 2.0 application, the attribute list passed as a parameter to eglChooseConfig() includes the attribute EGL_RENDERABLE_TYPE set to the value EGL_OPENGL_ES2_BIT.

Example 3.1 shows a coded section:

Example 3.1. 

EGLDisplay Display;

EGLint Attributes[] = {
                         // to return both 1.1 and 2.0 configs
    EGL_RED_SIZE, 8,

EGLConfig Configs[1];
EGLint NumConfigs;
eglChooseConfig(Display, Attributes, Configs, 1, &NumConfigs);

EGL context creation

The EGL library supplied with the OpenGL ES emulator supports both OpenGL ES 1.1 and OpenGL ES 2.0 contexts.

Ensure that, in the OpenGL ES 2.0 application, the attribute list passed as a parameter to eglCreateContext() includes the attribute EGL_CONTEXT_CLIENT_VERSION set to the value 2.

Example 3.2 shows a coded section:

Example 3.2. 

EGLDisplay Display;

EGLConfig Configs[1];

EGLint ContextAttributes[] = {
	EGL_CONTEXT_CLIENT_VERSION, 2, // selects OpenGL ES 2.0, 
                                   // set to 1 to select OpenGL ES 1.1
Context = eglCreateContext(Display, Configs[0], EGL_NO_CONTEXT,                            ContextAttributes);

Shader language version

The OpenGL ES emulator checks whether the graphics card has version 1.2 of the OpenGL 2.0 Shader Language (GLSL) available:

  • If version 1.2 is available, this is selected by the pragma #version 120 in the conversion of the ESSL shader to GLSL.

  • If version 1.2 is not available, pragma #version 110 selects GLSL version 1.1, that limits some features.

Copyright © 2009-2012 ARM. All rights reserved.ARM DUI 0511F