commit | b128dd9b253b1586458ecb78276eb1b1a74ad4e3 | [log] [tgz] |
---|---|---|
author | Eric Anholt <eric@anholt.net> | Mon Dec 09 22:14:09 2013 -0800 |
committer | Eric Anholt <eric@anholt.net> | Mon Dec 09 23:01:33 2013 -0800 |
tree | c270d6353e87bd8e136239143b00d4617ae559b7 | |
parent | d73f06fb4520705ad89036cdf2142307ccd1646c [diff] |
Move the check for whether to dlsym or GPA on linux to the common C code. This is going to change for macos and win32, and this will be easier than trying to spread that logic through the python code and into the generated code.
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. They get to read 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.
glBufferData()
can be used with GL_ARB_vertex_buffer_object
implementations, along with GL 1.5+ implementations.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>
As long as epoxy's headers appear first, you should be ready to go. Additionally, some new helpers become available, so you don't have to write them:
int epoxy_gl_version()
returns the GL version:
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?
GLEW has several issues:
glewInit()
autodetects the world.The motivation for this project came out of previous use of libGLEW in piglit. Other GL dispatch code generation projects had similar failures. Ideally, piglit wants to be able to build a single binary for a test that can run on whatever context or window system it chooses, not based on link time choices.
We had to solve some of GLEW's problems for piglit and solving them meant replacing every single piece of GLEW, so we built piglit-dispatch from scratch. And since we wanted to reuse it in other GL-related projects, this is the result.