O'Reilly logo

OpenGL Insights by Christophe Riccio, Patrick Cozzi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The ANGLE Project:
Implementing OpenGL ES 2.0
on Direct3D
Daniel Koch and Nicolas Capens
39.1 Introduction
The Almost Native Graphics Layer Engine (ANGLE) project is an open-source im-
plementation of OpenGL ES 2.0 for Windows. This chapter explores the challenges
that we encountered in the design of ANGLE and the solutions we implemented.
We begin the chapter by providing the motivation for ANGLE and some po-
tential uses of it. We then delve into the implementation details and explore the
design challenges that were involved in developing ANGLE. We discuss the feature
set that ANGLE provides, including the standard OpenGL ES and EGL extensions
that ANGLE supports, as well as some ANGLE-specific extensions [ANGLE 11].
We also describe in detail some of the optimizations that were implemented to en-
sure high performance and low overhead. We provide performance tips and guidance
for developers who may wish to use ANGLE directly in their own projects. We end
with some performance comparisons of WebGL implementations using ANGLE and
native Desktop OpenGL drivers.
39.2 Background
ANGLE is a conformant implementation of the OpenGL ES 2.0 specification
[Khronos 11c] that is hardware-accelerated via Direct3D. ANGLE version 1.0.772
was certified as compliant by passing the ES 2.0.3 conformance tests in October
543
39
544 VII Software Design
2011. ANGLE also provides an implementation of the EGL 1.4 specification
[Khronos 11b].
TransGaming did the primary development for ANGLE and provides continued
maintenance and feature enhancements. The development of ANGLE was spon-
sored by Google to enable browsers like Google Chrome to run WebGL content on
Windows computers that may not have OpenGL drivers [Bridge 10].
ANGLE is used as the default WebGL backend for both Google Chrome and
Mozilla Firefox on Windows platforms. Chrome, in fact, uses ANGLE for all graph-
ics rendering, including for the accelerated Canvas2D implementation and for the
Native Client sandbox environment.
In addition to providing an OpenGL ES 2.0 implementation for Windows, por-
tions of the ANGLE shader compiler are used as a shader validator and translator
by WebGL implementations across multiple platforms. It is used on Mac OS X
(Chrome, Firefox, and Safari), Linux (Chrome and Firefox), and in mobile variants
of the browsers. Having one shader validator helps to ensure that a consistent set
of GLSL ES (ESSL) shaders are accepted across browsers and platforms. The shader
translator is also used to translate shaders to other shading languages and to option-
ally apply shader modifications to work around bugs or quirks in the native graphics
drivers. The translator targets Desktop GLSL, Direct3D HLSL, and even ESSL for
native OpenGL ES 2.0 platforms.
Because ANGLE provides OpenGL ES 2.0 and EGL 1.4 libraries for Windows,
it can be used as a development tool by developers who want to target applications
for mobile, embedded, set-top, and Smart TV–based devices. Prototyping and initial
development can be done in the developers familiar Windows-based development
environment before final on-device performance tuning. Portability tools such as the
GameTree TV SDK [TransGaming 11] can further help to streamline this process
by making it possible to run Win32 and OpenGL ES 2.0-based applications directly
on set-top boxes. ANGLE also provides developers with an additional option for
deploying production versions of their applications to the desktop, either for content
that was initially developed on Windows, or for deploying OpenGL ES 2.0–based
content from other platforms such as iOS or Android.
39.3 Implementation
ANGLE is implemented in C++ and uses Direct3D 9 [ MSDN 11c] for rendering.
This API was chosen to allow us to target our implementation at Windows XP, Vista,
and 7, as well as providing access to a b road base of graphics hardware. ANGLE
requires a minimum of Shader Model (SM) 2 support, but due to the limited capa-
bilities of SM2, the primary target for our implementation is SM3. There are some
implementation variances, and in some cases, completely different approaches used,
in order to account for the different set of capabilities between SM2 and SM3. Since

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required