Angle

1 What is Angle.

The goal of ANGLE is to allow Windows users to seamlessly run WebGL and other OpenGL ES content by translating OpenGL ES API calls to DirectX 9 or DirectX 11 API calls.

ANGLE is a conformant implementation of the OpenGL ES 2.0 specification that is hardware‐accelerated via Direct3D. ANGLE v1.0.772 was certified compliant by passing the ES 2.0.3 conformance tests in October 2011. ANGLE also provides an implementation of the EGL 1.4 specification. Work on ANGLE‘s OpenGL ES 3.0 implementation is currently in progress, but should not be considered stable.

ANGLE is used as the default WebGL backend for both Google Chrome and Mozilla Firefox on Windows platforms. Chrome uses ANGLE for all graphics rendering on Windows, including the accelerated Canvas2D implementation and the Native Client sandbox environment.

Portions 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, Linux, and in mobile variants of the browsers. Having one shader validator helps to ensure that a consistent set of GLSL ES shaders are accepted across browsers and platforms. The shader translator can be used to translate shaders to other shading languages, and to optionally 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 GLES2 platforms.

2 Related project.

3 How to install.

Version Control

ANGLE uses git for version control. If you are not familiar with git, helpful documentation can be found at http://git-scm.com/documentation

Required Tools

  1. Visual Studio Community 2013
    • Required to build ANGLE on Windows and for the packaged Windows 8.1 SDK.
  2. depot_tools
    • Required to generate projects and build files, contribute patches, run the unit tests or build the shader compiler on non-Windows systems.
  3. Bison, flex, and patch (optional)
    • This is only required if you need to modify GLSL ES grammar files (glslang.l and glslang.y under src/compiler/translator).
    • All packages are available as part of cygwin or gnuwin32 distribution on Windows.

Application Development with ANGLE

This sections describes how to use ANGLE to build an OpenGL ES application.

Getting the source

Set the following environment variables as needed:

  • 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 2013 (or 2013e for Express editions of MSVS)

Download the ANGLE source by running the following commands:

mkdir anglecd anglegclient config --name . --unmanaged https://chromium.googlesource.com/angle/angle.gitgclient syncgit checkout master

The generated visual studio project files will be located in the buildsrcsamples and tests directories. The projects can be regenerated by executing gclient runhooks

Building ANGLE

  1. Open one of the ANGLE Visual Studio solution files (see DevSetup#Getting_the_source).
  2. Select Build -> Configuration Manager
  3. In the "Active solution configuration:" drop down, select the desired configuration (eg. Release), and close the Configuration Manager.
  4. Select Build -> Build Solution.

Once the build completes, the output directory for your selected configuration (eg. 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.

Choosing a D3D Backend

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 inextensions/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 D3D9 renderer. To change the default:

  1. Open src/libANGLE/renderer/Renderer.cpp

   2.  Locate the definition of ANGLE_DEFAULT_D3D11 near the head of the file, and ensure it is set to 1.

4 How to use.

  1. Configure your build environment to have access to the include folder to provide access to the standard Khronos EGL and GLES2 header files.
    • For Visual C++
      • Right-click your project in the Solution Explorer, and select Properties.
      • Under the Configuration Properties branch, click C/C++.
      • Add the relative path to the Khronos EGL and GLES2 header files to Additional Include Directories.
  2. Configure your build environment to have access to libEGL.lib and libGLESv2.lib found in the build output directory (seeDevSetup#Building_ANGLE).
    • For Visual C++
      • Right-click your project in the Solution Explorer, and select Properties.
      • Under the Configuration Properties branch, open the Linker branch and click Input.
      • Add the relative paths to both the libEGL.lib file and libGLESv2.lib file to Additional Dependencies, separated by a semicolon.
  3. Copy libEGL.dll and libGLESv2.dll from the build output directory (see DevSetup#Building_ANGLE) into your application folder.
  4. Code your application to the Khronos OpenGL ES 2.0 and EGL 1.4 APIs

GLSL ES to GLSL Translator

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.

Getting the source

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.

Usage

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:

  1. ShInitialize() initializes the translator library and must be called only once from each process using the translator.
  2. ShContructCompiler() creates a translator object for vertex or fragment shader.
  3. ShCompile() translates the given shader.
  4. ShDestruct() destroys the given translator.
  5. ShFinalize() shuts down the translator library and must be called only once from each process using the translator.
时间: 2024-10-31 11:04:25

Angle的相关文章

hoj 1010 The Angle

The interval angle between the hour hand and the minute hand is always among 0 degree and 180 degree(including 0 and 180 degree). For example, when it's 12 o'clock, the angle of the two hands is 0 while 6:00 is 180 degree. Try to calculate any degree

cvBox2D和RotatedRect中返回的角度angle详解

本文为作者原创,未经允许不得转载 关于cvBox2D和RotatedRect中返回的角度angle的opencv官方说明文档里面没有给出太多到信息,其中文档是这样说的: 图1:opencv关于cvBox2D的说明文档截图 在水平轴和第一条边之间的角度.(好简洁,但是真的并没有太明确) 在网上也有关于cvBox2D和RotatedRect的角度angle的说明,但是查看了一下,不对,或者不完全对.其中有两篇:http://blog.csdn.net/mine1024/article/details

如何让Maya中的相机和Unity相机的FOV(Angle of View)对上

问题: Unity中的Camera的FOV和Maya中Camera的Angle of View即使设置成相同值,预览时结果会有很大差异 原因: Unity Camera的FOV是Vertical FOV的角度 Maya Camera的Angle of View是Horizontal FOV的角度 解决方法 先保证Maya和Unity中的Aspect Ratio一致,然后再按照长宽比换算两者各自应该使用的FOV或者Angle of View. 例如按照下面的方式设置,即可实现两边完全一样 Unit

cf View Angle

View Angle Description Flatland has recently introduced a new type of an eye check for the driver's licence. The check goes like that: there is a plane with mannequins standing on it. You should tell the value of the minimum angle with the vertex at

Shader中一直一个坐标(x,y)求旋转角度angle之后的坐标。

finalx = cos(angle)*x - sin(angle)*y finaly = sin(angle)*x +cos(angle)*y 或者有原角度加上旋转后的角度的到新角度a之后,假设改箱量长度为b则: finaly = b * sin(a) finalx = b * cos(a)

Clock Angle

Problem We are given a specific time(like 02:23), we need to get the angle between hour and minute(less than 180) Solution 1 public static double clockAngle(String time) { 2 if(time == null) return -1; 3 double angle = 0; 4 5 int hour = 0, minute = 0

Lua实现angle角

function i3k_vec3(x, y, z) return { x = x, y = y, z = z }; end function i3k_vec3_normalize1(v) return i3k_vec3_normalize2(v.x, v.y, v.z); end function i3k_vec3_normalize2(x, y, z) local _x = x; local _y = y; local _z = z; local d = math.sqrt(_x * _x

hdu 3532 Max Angle(atan2的使用)

Max Angle Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 678    Accepted Submission(s): 238 Problem Description Given many points in a plane, two players are playing an interesting game. Player

#421(div2)B. Mister B and Angle in Polygon

On one quiet day all of sudden Mister B decided to draw angle a on his field. Aliens have already visited his field and left many different geometric figures on it. One of the figures is regular convex n-gon (regular convex polygon with n sides). Tha

HDU 3532 Max Angle(计算几何——极角排序)

传送门 Max Angle Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 704    Accepted Submission(s): 253 Problem Description Given many points in a plane, two players are playing an interesting game. Pl