commit | e230042ffe3f55c24153d908c8aa0c255e1b3620 | [log] [tgz] |
---|---|---|
author | Eric Anholt <eric@anholt.net> | Thu Mar 27 18:36:59 2014 -0700 |
committer | Eric Anholt <eric@anholt.net> | Thu Mar 27 23:17:02 2014 -0700 |
tree | 173bb5113bc1ddec67215f82fcf1448636f1734b | |
parent | 46da7790b2f327d49b20597c92a10de20a8efba3 [diff] |
test: Add a test using GLX_EXT_create_context_es2_profile. This is based on a bug report from Steinar H. Gunderson about using GLES3 with SDL and epoxy.
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../autogen.sh make sudo make install
Dependencies for debian:
Dependencies for OS X (macports):
Other dependencies for OS X:
The test suite has additional dependencies depending on the platform. (X11, EGL, a running X Server).
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.
The automatic per-context symbol resolution for win32 requires that epoxy knows when wglMakeCurrent()
is called, because wglGetProcAddress() return values depend on the context's device and pixel format. If wglMakeCurrent()
is called from outside of epoxy (in a way that might change the device or pixel format), then epoxy needs to be notified of the change using the epoxy_handle_external_wglMakeCurrent()
function.
The win32 dispatch layer is currently slower than it should be in the single-context (or multi-context, but same device and pixel format) case. We need to switch to using the linux-like function pointer stubs, and detect when transitioning to multi-device/format and hook in the per-thread dispatch table at that point.
The win32 wglMakeCurrent () variants are slower than they should be, because they should be caching the resolved dispatch tables instead of resetting an entire thread-local dispatch table every time.