ANGLE is a wrapper library that implements OpenGL ES API (version 2.0 and parts of 3.0) and translates OpenGL ES calls to their DirectX equivalents. See https://github.com/MSOpenTech/angle for more information.
There are two options how to use ANGLE: install its binaries as a NuGet package or compile it from the source code. I believe that cool software developers, like real heroes, never search easy ways, so I decided to compile ANGLE from the source code with VS2015 Community.
First I cloned the repository and ensured that my branch is ms-master:
Then I successfully built solution angle\winrt\10\src\angle.sln (like a real hero of cause). The result of this feat were two DLLs in Debug_Win32 subfolder: libEGL.dll and libGLESv2.dll and the following libraries in Debug_Win32/lib: angle_common.lib libANGLE.lib libEGL.exp libEGL.lib libGLESv2.exp libGLESv2.lib preprocessor.lib translator.lib translator_lib.lib translator_static.lib.
The most of the samples in angle\samples\samples.sln solution also built fine. Typical sample application includes the following headers:
#include <EGL/egl.h> #include <EGL/eglext.h>
and use some CreateOSWindow() function from angle\util\OSWindow.h for creating a top-level window that hosts the OpenGL surface. It can be Win32Window, WinRTWindow, OSXWindow or X11Window.
Below I provided screenshots of some sample applications.
multi_window sample
it creates five top-level windows with the following code:
const size_t numWindows = 5; for (size_t i = 1; i < numWindows; i++) { window window; window.osWindow = CreateOSWindow(); if (!window.osWindow->initialize("MultiWindow", 256, 256)) { return false; } window.surface = eglCreateWindowSurface(getDisplay(), getConfig(), window.osWindow->getNativeWindow(), nullptr); if (window.surface == EGL_NO_SURFACE) { return false; } window.osWindow->setVisible(true); mWindows.push_back(window); }
and uses some interesting construct for embedding the shader source code into C++:
const std::string vs = SHADER_SOURCE ( attribute vec4 vPosition; void main() { gl_Position = vPosition; } );
Looks like ANGLE does not support antialiasing at the moment. At least this http://stackoverflow.com/questions/8338696/how-to-draw-anti-aliased-lines-in-opengl-es-2-0 does not work with ANGLE. eglChooseConfig() function fails with EGL_SAMPLE_BUFFERS = 1 all the time. Search “sampleBuffers” in ANGLE source code shows “FIXME: enumerate multi-sampling” etc., so looks like it is not implemented yet. Finally there is the following function in the ANGLE sources:
GLsizei SurfaceRenderTarget11::getSamples() const
{
// Our EGL surfaces do not support multisampling.
return 0;
}