• Home
Name
Date
Size
#Lines
LOC

..--

.github/03-May-2024-179144

cross/03-May-2024-1916

doc/03-May-2024-268251

include/epoxy/03-May-2024-396173

prebuilt-intermediates/03-May-2024-158,058147,702

registry/03-May-2024-58,93457,766

src/03-May-2024-2,6881,638

test/03-May-2024-3,1771,782

.dir-locals.elD03-May-202481 76

.editorconfigD03-May-2024303 2317

.gitignoreD03-May-20241 KiB8280

Android.bpD03-May-20242.3 KiB7167

COPYINGD03-May-20242.4 KiB5147

LICENSED03-May-20242.4 KiB5147

METADATAD03-May-2024522 2018

OWNERSD03-May-2024124 76

README.mdD03-May-20244.1 KiB12796

generate-prebuilts.shD03-May-2024217 86

meson.buildD03-May-20247.4 KiB230203

meson_options.txtD03-May-2024642 2221

README.md

1![Ubuntu](https://github.com/anholt/libepoxy/workflows/Ubuntu/badge.svg)
2![macOS](https://github.com/anholt/libepoxy/workflows/macOS/badge.svg)
3![MSVC Build](https://github.com/anholt/libepoxy/workflows/MSVC%20Build/badge.svg)
4![MSYS2 Build](https://github.com/anholt/libepoxy/workflows/MSYS2%20Build/badge.svg)
5[![License: MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)
6
7Epoxy is a library for handling OpenGL function pointer management for
8you.
9
10It hides the complexity of `dlopen()`, `dlsym()`, `glXGetProcAddress()`,
11`eglGetProcAddress()`, etc. from the app developer, with very little
12knowledge needed on their part.  They get to read GL specs and write
13code using undecorated function names like `glCompileShader()`.
14
15Don't forget to check for your extensions or versions being present
16before you use them, just like before!  We'll tell you what you forgot
17to check for instead of just segfaulting, though.
18
19Features
20--------
21
22  * Automatically initializes as new GL functions are used.
23  * GL 4.6 core and compatibility context support.
24  * GLES 1/2/3 context support.
25  * Knows about function aliases so (e.g.) `glBufferData()` can be
26    used with `GL_ARB_vertex_buffer_object` implementations, along
27    with GL 1.5+ implementations.
28  * EGL, GLX, and WGL support.
29  * Can be mixed with non-epoxy GL usage.
30
31Building
32--------
33
34```sh
35mkdir _build && cd _build
36meson
37ninja
38sudo ninja install
39```
40
41Dependencies for Debian:
42
43  * meson
44  * libegl1-mesa-dev
45
46Dependencies for macOS (using MacPorts):
47
48  * pkgconfig
49  * meson
50
51The test suite has additional dependencies depending on the platform.
52(X11, EGL, a running X Server).
53
54Switching your code to using epoxy
55----------------------------------
56
57It should be as easy as replacing:
58
59```cpp
60#include <GL/gl.h>
61#include <GL/glx.h>
62#include <GL/glext.h>
63```
64
65with:
66
67```cpp
68#include <epoxy/gl.h>
69#include <epoxy/glx.h>
70```
71
72As long as epoxy's headers appear first, you should be ready to go.
73Additionally, some new helpers become available, so you don't have to
74write them:
75
76`int epoxy_gl_version()` returns the GL version:
77
78  * 12 for GL 1.2
79  * 20 for GL 2.0
80  * 44 for GL 4.4
81
82`bool epoxy_has_gl_extension()` returns whether a GL extension is
83available (`GL_ARB_texture_buffer_object`, for example).
84
85Note that this is not terribly fast, so keep it out of your hot paths,
86ok?
87
88Why not use libGLEW?
89--------------------
90
91GLEW has several issues:
92
93  * Doesn't know about aliases of functions (There are 5 providers of
94    `glPointParameterfv()`, for example, and you don't want to have to
95    choose which one to call when they're all the same).
96  * Doesn't support OpenGL ES.
97  * Has a hard-to-maintain parser of extension specification text
98    instead of using the old .spec file or the new .xml.
99  * Has significant startup time overhead when `glewInit()`
100    autodetects the world.
101  * User-visible multithreading support choice for win32.
102
103The motivation for this project came out of previous use of libGLEW in
104[piglit](http://piglit.freedesktop.org/).  Other GL dispatch code
105generation projects had similar failures.  Ideally, piglit wants to be
106able to build a single binary for a test that can run on whatever
107context or window system it chooses, not based on link time choices.
108
109We had to solve some of GLEW's problems for piglit and solving them
110meant replacing every single piece of GLEW, so we built
111piglit-dispatch from scratch.  And since we wanted to reuse it in
112other GL-related projects, this is the result.
113
114Known issues when running on Windows
115------------------------------------
116
117The automatic per-context symbol resolution for win32 requires that
118epoxy knows when `wglMakeCurrent()` is called, because `wglGetProcAddress()`
119returns values depend on the context's device and pixel format.  If
120`wglMakeCurrent()` is called from outside of epoxy (in a way that might
121change the device or pixel format), then epoxy needs to be notified of
122the change using the `epoxy_handle_external_wglMakeCurrent()` function.
123
124The win32 `wglMakeCurrent()` variants are slower than they should be,
125because they should be caching the resolved dispatch tables instead of
126resetting an entire thread-local dispatch table every time.
127