一、总的入口
https://www.khronos.org/opengl/wiki/Getting_Started#Downloading_OpenGL
So you want to take advantage of the power of the OpenGL API? If you are visiting this page because a game or software uses the OpenGL API, you need to install the appropriate graphic driver which enables usage of the functionality provided.
To program using the OpenGL API, you need the driver and the development package (depends on platform and programming language). More platform-specific details are described in the sections below.
二、LINUX专用:
https://www.khronos.org/opengl/wiki/Platform_specifics:_Linux
Platform specifics: Linux
This Section explains how to install Drivers to make OpenGL Programs run under Linux and how to use different Libraries/Toolkits to create Opengl Programs.
Mesa is an open-source OpenGL implementation, continually updated to support the latest OpenGL specification.
Direct Rendering Infrastructure, also known as the DRI, is a framework for allowing direct access to graphics hardware under the X Window System in a safe and efficient manner.
http://dri.freedesktop.org/wiki/
Mesa implements EGL 1.4
Mesa implements OpenGL ES 1.1 and OpenGL ES 2.0
http://mesa3d.org/opengles.htmlMesa 11.0.0 implements the OpenGL 4.1 API. OpenGL 4.1 is only available if requested at context creation because compatibility contexts are not supported.
三、GLEW:
The OpenGL Extension Wrangler Library
The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library. GLEW provides efficient run-time mechanisms for determining which OpenGL extensions are supported on the target platform. OpenGL core and extension functionality is exposed in a single header file. GLEW has been tested on a variety of operating systems, including Windows, Linux, Mac OS X, FreeBSD, Irix, and Solaris.
Downloads
GLEW is distributed as source and precompiled binaries.
The latest release is 2.1.0[07-31-17]:
|
An up-to-date copy is also available using git:
- github
git clone https://github.com/nigels-com/glew.git glew
Supported Extensions
The latest release contains support for OpenGL 4.6, compatibility and forward-compatible contexts and the following extensions:
News
- [07-31-17] GLEW 2.1.0 adds support for OpenGL 4.6, new extensions and minor bug fixes
- [07-24-16] GLEW 2.0.0 adds support for forward-compatible contexts, adds new extensions, OSMesa and EGL support, MX discontinued and minor bug fixes
- [08-10-15] GLEW 1.13.0 adds support for new extensions, fixes minor bugs
- [26-01-15] GLEW 1.12.0 fixes minor bugs and adds new extensions
- [08-11-14] GLEW 1.11.0 adds support for OpenGL 4.5, new extensions
- [07-22-13] GLEW 1.10.0 adds support for OpenGL 4.4, new extensions
- [08-06-12] GLEW 1.9.0 adds support for OpenGL 4.3, new extensions
- [07-17-12] GLEW 1.8.0 fixes minor bugs and adds new extensions
- [08-26-11] GLEW 1.7.0 adds support for OpenGL 4.2, new extensions, fixes bugs
- [04-27-11] GLEW 1.6.0 fixes minor bugs and adds eight new extensions
- [01-31-11] GLEW 1.5.8 fixes minor bugs and adds two new extensions
- [11-03-10] GLEW 1.5.7 fixes minor bugs and adds one new extension
- [09-07-10] GLEW 1.5.6 adds support for OpenGL 4.1, fixes bugs
四、OPENGL ES 源代码(ES 1.1和ES 2.0):
https://www.mesa3d.org/opengles.html
OpenGL ES
Mesa implements OpenGL ES 1.1 and OpenGL ES 2.0. More information about OpenGL ES can be found at https://www.khronos.org/opengles/.
OpenGL ES depends on a working EGL implementation. Please refer to Mesa EGL for more information about EGL.
Build the Libraries
- Run
configure
with--enable-gles1 --enable-gles2
and enable the Gallium driver for your hardware. - Build and install Mesa as usual.
Alternatively, if XCB-DRI2 is installed on the system, one can use egl_dri2
EGL driver with OpenGL|ES-enabled DRI drivers
- Run
configure
with--enable-gles1 --enable-gles2
. - Build and install Mesa as usual.
Both methods will install libGLESv1_CM, libGLESv2, libEGL, and one or more EGL drivers for your hardware.
Run the Demos
There are some demos in mesa/demos
repository.
Developers
Dispatch Table
OpenGL ES has an additional indirection when dispatching functions
Mesa: glFoo() --> _mesa_Foo() OpenGL ES: glFoo() --> _es_Foo() --> _mesa_Foo()
The indirection serves several purposes
- When a function is in Mesa and the type matches, it checks the arguments and calls the Mesa function.
- When a function is in Mesa but the type mismatches, it checks and converts the arguments before calling the Mesa function.
- When a function is not available in Mesa, or accepts arguments that are not available in OpenGL, it provides its own implementation.
Other than the last case, OpenGL ES uses APIspec.xml
to generate functions to check and/or converts the arguments.