ANGLE provides OpenGL ES 2.0 and EGL 1.4 libraries and dlls. You can use these to build and run OpenGL ES 2.0 applications on Windows.
ANGLE uses git for version control. If you are not familiar with git, helpful documentation can be found at http://git-scm.com/documentation.
On all platforms:
On Windows:
glslang.l
and glslang.y
under src/compiler/translator
, or ExpressionParser.y
and Tokenizer.l
in src/compiler/preprocessor
). Use the latest versions of bison, flex and patch from the 64-bit cygwin distribution.On Linux:
On MacOS:
Set the following environment variables as needed:
On Windows:
GYP_GENERATORS
to msvs
(other options include ninja
and make
)GYP_DEFINES
to windows_sdk_path=YOUR_WIN_SDK_INSTALL_DIR
if you did not install the Windows 8.1 SDK in the default location.GYP_MSVS_VERSION
to 2015
On Linux and MacOS:
GYP_GENERATORS
to ninja
(defaults to 'make' that pollutes your source directory)Download the ANGLE source by running the following commands:
git clone https://chromium.googlesource.com/angle/angle cd angle python scripts/bootstrap.py gclient sync git checkout master
GYP will generate the project files, if you update ANGLE or make a change to the projects, they can be regenerated by executing gclient runhooks
.
On Windows GYP will generate the main VS2015 solution file as build/ANGLE.sln. For generating a Windows Store version of ANGLE view the Windows Store instructions.
On Linux and MacOS, GYP will generate the out/Debug
and out/Release
directories.
Release_Win32
, located next to the solution file) will contain the required libraries and dlls to build and run an OpenGL ES 2.0 application.Run ninja -C out/Debug
or ninja -C out/Release
. Ninja is provided by depot_tools
so make sure you set up your PATH
correctly. Once the build completes, the out/Debug
or out/Release
directories will contain the .so or .dylib libraries and test binaries.
This sections describes how to use ANGLE to build an OpenGL ES application.
ANGLE can use either a backing renderer which uses D3D11 on systems where it is available, or a D3D9-only renderer.
ANGLE provides an EGL extension called EGL_ANGLE_platform_angle
which allows uers to select which renderer to use at EGL initialization time by calling eglGetPlatformDisplayEXT with special enums. Details of the extension can be found in it's specification in extensions/ANGLE_platform_angle.txt
and extensions/ANGLE_platform_angle_d3d.txt
and examples of it's use can be seen in the ANGLE samples and tests, particularly util/EGLWindow.cpp
.
By default, ANGLE will use a D3D11 renderer. To change the default:
src/libANGLE/renderer/d3d/DisplayD3D.cpp
ANGLE_DEFAULT_D3D11
near the head of the file, and set it to your preference.On Windows:
include
folder to provide access to the standard Khronos EGL and GLES2 header files.libEGL.lib
and libGLESv2.lib
found in the build output directory (see Building ANGLE).libEGL.lib
file and libGLESv2.lib
file to Additional Dependencies, separated by a semicolon.libEGL.dll
and libGLESv2.dll
from the build output directory (see Building ANGLE) into your application folder.On Linux and MacOS, either:
libGLESv2
and libEGL
dlopen
to load the OpenGL ES and EGL entry points at runtime.In addition to OpenGL ES 2.0 and EGL 1.4 libraries, ANGLE also provides a GLSL ES to GLSL translator. This is useful for implementing OpenGL ES emulators on top of desktop OpenGL.
The translator code is fully independent of the rest of ANGLE code and resides in src/compiler
. It is cross-platform and build files for operating systems other than Windows can be generated by following the Generating project files
steps above.
The basic usage is shown in essl_to_glsl
sample under samples/translator
. To translate a GLSL ES shader, following functions need to be called in the same order:
ShInitialize()
initializes the translator library and must be called only once from each process using the translator.ShContructCompiler()
creates a translator object for vertex or fragment shader.ShCompile()
translates the given shader.ShDestruct()
destroys the given translator.ShFinalize()
shuts down the translator library and must be called only once from each process using the translator.