Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
.github/ | 03-May-2024 | - | 179 | 144 | ||
cross/ | 03-May-2024 | - | 19 | 16 | ||
doc/ | 03-May-2024 | - | 268 | 251 | ||
include/epoxy/ | 03-May-2024 | - | 396 | 173 | ||
prebuilt-intermediates/ | 03-May-2024 | - | 158,058 | 147,702 | ||
registry/ | 03-May-2024 | - | 58,934 | 57,766 | ||
src/ | 03-May-2024 | - | 2,688 | 1,638 | ||
test/ | 03-May-2024 | - | 3,177 | 1,782 | ||
.dir-locals.el | D | 03-May-2024 | 81 | 7 | 6 | |
.editorconfig | D | 03-May-2024 | 303 | 23 | 17 | |
.gitignore | D | 03-May-2024 | 1 KiB | 82 | 80 | |
Android.bp | D | 03-May-2024 | 2.3 KiB | 71 | 67 | |
COPYING | D | 03-May-2024 | 2.4 KiB | 51 | 47 | |
LICENSE | D | 03-May-2024 | 2.4 KiB | 51 | 47 | |
METADATA | D | 03-May-2024 | 522 | 20 | 18 | |
OWNERS | D | 03-May-2024 | 124 | 7 | 6 | |
README.md | D | 03-May-2024 | 4.1 KiB | 127 | 96 | |
generate-prebuilts.sh | D | 03-May-2024 | 217 | 8 | 6 | |
meson.build | D | 03-May-2024 | 7.4 KiB | 230 | 203 | |
meson_options.txt | D | 03-May-2024 | 642 | 22 | 21 |
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