2.2.2. OpenGL ES Emulator integration

This section describes:

OpenGL ES Emulator DLLs and libraries

The OpenGL ES Emulator Library consists of DLLs, corresponding to the OpenGL ES 2.0, OpenGL ES 1.1, and EGL 1.3 APIs. For each of these DLLs, there is a corresponding import library for an OpenGL ES 2.0 or OpenGL ES 1.1 application to statically link against.

OpenGL ES 2.0 and OpenGL ES 1.1 applications must include both of their import libraries in builds to link against the OpenGL ES 2.0 and EGL 1.3 APIs or OpenGL ES 1.1 and EGL 1.3 APIs. The DLLs use the __stdcall calling convention.

Table 2.1 shows the files for OpenGL ES 1.1 and Open GL ES 2.0 emulation:

Table 2.1. OpenGL ES Emulator library structure

bin\libGLESv2.dllDLL for OpenGL ES 2.0 emulation
bin\libEGL.dllDLL for EGL implementation
lib\libGLESv2.libImport library for libGLESv2.dll
lib\libEGL.libImport library for libEGL.dll
bin\libGLESv1_CM.dllDLL for OpenGL ES 1.1 emulation
lib\libGLESv1_CM.libImport library for libGLESv1_CM.dll

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.lib instead of libGLESv2.lib.

EGL configuration

The EGL library supplied with the OpenGL ES Emulator supports OpenGL ES 1.1 and OpenGL ES 2.0. Ensure that, in the OpenGL ES 2.0 application, the attribute list passed as a parameter to eglChooseConfig() includes the attribute EGL_RENDERABLE_TYPE with the value EGL_OPENGL_ES2_BIT for OpenGL 2.0 applications.


  • Use EGL_OPENGL_ES_BIT|EGL_OPENGL_ES2_BIT to request both OpenGL ES 1.1 and OpenGL ES 2.0 configs.

  • The actual context used is specified in eglCreateContext() described in Example 2.2.

Example 2.1 shows a coded section.

Example 2.1. EGL context configuration

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

Example 2.2 shows a coded section. Set the second element of the ContextAttributes array to 2 to select an OpenGL ES 2.0 context.


  • The OpenGL ES Emulator also works with OpenGL ES 1.1 contexts.

  • Set the second element of the ContextAttributes array to 1 to select an OpenGL ES 1.1 context

Example 2.2. EGL context creation

EGLDisplay Display;
EGLConfig Configs[1];
EGLint ContextAttributes[] = {
    2,      // selects OpenGL ES 2.0, set to 1 to select OpenGL ES 1.1


Context = eglCreateContext(Display, Configs[0], EGL_NO_CONTEXT,

Shader syntax checking by the Mali GPU Offline Shader Compiler

The shading language for use with the OpenGL ES 2.0 API is OpenGL ES Shading Language (ESSL). See the OpenGL ES Shading Language Specification. The corresponding shading language for use with OpenGL 2.0 API is OpenGL Shading Language (GLSL).

The OpenGL ES Emulator validates the shader source:

  1. If the Mali GPU Offline Shader Compiler is installed and is present in the PATH environment variable, the OpenGL ES Emulator uses this compiler to check the shader syntax for the ESSL code.

  2. The OpenGL ES Emulator modifies the validated ESSL code to make it compliant GLSL code.

  3. The generated GLSL code is passed to the GLSL compiler in the OpenGL graphics driver of your Windows desktop machine.

Limitations based on the shader language version

For OpenGL ES 2.0 applications, 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 using pragma #version 120 in the conversion of the ESSL shader to GLSL code.

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

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