You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Eric Anholt 69241485d1 Fix test for is_desktop_gl. 11 years ago
include/epoxy Add the generator and build infrastructure. 11 years ago
registry Import khronos API registry from SVN commit 22908 11 years ago
src Fix test for is_desktop_gl. 11 years ago
.dir-locals.el Add .dir-locals to tell emacs how to format by default. 11 years ago
.gitignore Add the generator and build infrastructure. 11 years ago
Makefile.am Add the generator and build infrastructure. 11 years ago
README.md Add the generator and build infrastructure. 11 years ago
autogen.sh Add the generator and build infrastructure. 11 years ago
configure.ac Add the generator and build infrastructure. 11 years ago
epoxy.pc.in Add the generator and build infrastructure. 11 years ago

README.md

Epoxy is a library for handling OpenGL function pointer management for you.

It hides the complexity of dlopen(), dlsym(), glXGetProcAddress(), eglGetProcAddress(), etc. from the app developer, with very little knowledge needed on their part. Just read your GL specs and write code using undecorated function names like glCompileShader().

Don't forget to check for your extensions or versions being present before you use them, just like before! We'll tell you what you forgot to check for instead of just segfaulting, though.

Why does this library exist?

OpenGL on Linux (and other platforms) made some ABI decisions back in the days when symbol versioning and dlsym() weren't as widely available, that resulted in window-systems-specific APIs that looked kind of like dlsym. They allowed you to build an app that required OpenGL 1.2, but could optionally use features of OpenGL 1.4 if the implementation made those available through the glXGetProcAddress() (or other similarly-named) mechanism.

The downside is that the fixed OpenGL 1.2 ABI means that application developers have to GetProcAddress() out every modern GL entrypoint they want to use and stash that function pointer somewhere. Sometimes this is done in a pretty way (like libGLEW), sometimes it is done in an ad-hoc way (like most applications I've seen), but it's never done as well as we think it could be done.

Additionally, the proliferation of OpenGL ABIs (desktop GL, GLESv1, GLESv2) and window systems (GLX, AGL, WGL, all versus EGL) means that

Switching your code to using epoxy

It should be as easy as replacing:

#include <GL/gl.h> #include <GL/glx.h> #include <GL/glext.h>

with:

#include <epoxy/gl.h> #include <epoxy/glx.h>

Additionally, some new helpers become available, so you don't have to write them:

int epoxy_gl_version() returns the GL version:

12 for GL 1.2 20 for GL 2.0 44 for GL 4.4

bool epoxy_has_gl_extension() returns whether a GL extension is available ("GL_ARB_texture_buffer_object", for example).

Note that this is not terribly fast, so keep it out of your hot paths, ok?