mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-20 17:30:07 +01:00
[gl] Use GLEW to detect required extension presence.
This commit is contained in:
parent
2df498ba45
commit
93c437d4b9
2 changed files with 22 additions and 0 deletions
|
|
@ -196,6 +196,15 @@ CAIRO_ENABLE_SURFACE_BACKEND(gl, gl, no, [
|
|||
gl_REQUIRES="gl"
|
||||
PKG_CHECK_MODULES(gl, $gl_REQUIRES, , [AC_MSG_RESULT(no)
|
||||
use_gl="no (requires gl.pc)"])
|
||||
|
||||
AC_CHECK_LIB(GLEW, glewInit, [
|
||||
AC_CHECK_HEADER(GL/glew.h, [], [
|
||||
have_gl="no (requires glew http://glew.sourceforge.net/)"
|
||||
])
|
||||
], [
|
||||
have_gl="no (requires glew http://glew.sourceforge.net/)"
|
||||
])
|
||||
gl_NONPKGCONFIG_LIBS="-lGLEW"
|
||||
])
|
||||
|
||||
dnl ===========================================================================
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include <GL/glew.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glx.h>
|
||||
#include <GL/glext.h>
|
||||
|
|
@ -127,6 +128,7 @@ cairo_gl_context_t *
|
|||
cairo_gl_glx_context_create (Display *dpy, GLXContext gl_ctx)
|
||||
{
|
||||
cairo_gl_context_t *ctx;
|
||||
GLenum err;
|
||||
|
||||
ctx = calloc (1, sizeof(cairo_gl_context_t));
|
||||
if (ctx == NULL)
|
||||
|
|
@ -143,6 +145,17 @@ cairo_gl_glx_context_create (Display *dpy, GLXContext gl_ctx)
|
|||
*/
|
||||
glXMakeCurrent(dpy, RootWindow (dpy, DefaultScreen (dpy)), gl_ctx);
|
||||
|
||||
err = glewInit();
|
||||
if (err != GLEW_OK) {
|
||||
free(ctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!GLEW_EXT_framebuffer_object || !GLEW_ARB_texture_env_combine) {
|
||||
free(ctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Set up the dummy texture for tex_env_combine with constant color. */
|
||||
glGenTextures (1, &ctx->dummy_tex);
|
||||
glBindTexture (GL_TEXTURE_2D, ctx->dummy_tex);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue