diff --git a/cogl/Makefile.am b/cogl/Makefile.am index efdfd497c..424170fc7 100644 --- a/cogl/Makefile.am +++ b/cogl/Makefile.am @@ -34,9 +34,9 @@ AM_CPPFLAGS = \ AM_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS) -BUILT_SOURCES += cogl-defines.h -DISTCLEANFILES += cogl-defines.h -EXTRA_DIST += cogl-defines.h.in +BUILT_SOURCES += cogl-defines.h cogl-gl-header.h +DISTCLEANFILES += cogl-defines.h cogl-gl-header.h +EXTRA_DIST += cogl-defines.h.in cogl-gl-header.h.in # Note: The cogl-1.0/cogl-gl-1.0 files are essentially for # compatability only. I'm not really sure who could possibly be using diff --git a/cogl/cogl-buffer-private.h b/cogl/cogl-buffer-private.h index 62bcf4595..0457af024 100644 --- a/cogl/cogl-buffer-private.h +++ b/cogl/cogl-buffer-private.h @@ -33,6 +33,7 @@ #include "cogl-object-private.h" #include "cogl-buffer.h" #include "cogl-context.h" +#include "cogl-gl-header.h" G_BEGIN_DECLS diff --git a/cogl/cogl-context-private.h b/cogl/cogl-context-private.h index 333235bb4..faeff493c 100644 --- a/cogl/cogl-context-private.h +++ b/cogl/cogl-context-private.h @@ -49,6 +49,7 @@ #include "cogl-texture-rectangle.h" #include "cogl-sampler-cache-private.h" #include "cogl-gpu-info-private.h" +#include "cogl-gl-header.h" typedef struct { diff --git a/cogl/cogl-defines.h.in b/cogl/cogl-defines.h.in index 3d4b17d20..ccdca066b 100644 --- a/cogl/cogl-defines.h.in +++ b/cogl/cogl-defines.h.in @@ -29,7 +29,6 @@ #define __COGL_DEFINES_H__ #include -@COGL_GL_HEADER_INCLUDES@ G_BEGIN_DECLS @@ -41,9 +40,6 @@ G_BEGIN_DECLS #define NativeWindowType EGLNativeWindowType #endif -#ifndef GL_OES_EGL_image -#define GLeglImageOES void * -#endif G_END_DECLS #endif diff --git a/cogl/cogl-gl-header.h.in b/cogl/cogl-gl-header.h.in new file mode 100644 index 000000000..30bc8376f --- /dev/null +++ b/cogl/cogl-gl-header.h.in @@ -0,0 +1,39 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2012 Intel Corporation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * + */ + +#if !defined(CLUTTER_COMPILATION) +#error "cogl-gl-header.h should only be included when compiling Cogl" +#endif + +#ifndef __COGL_GL_HEADER_H__ +#define __COGL_GL_HEADER_H__ + +#include "cogl-defines.h" + +@COGL_GL_HEADER_INCLUDES@ + +#ifndef GL_OES_EGL_image +#define GLeglImageOES void * +#endif + +#endif /* __COGL_GL_HEADER_H__ */ diff --git a/cogl/cogl-internal.h b/cogl/cogl-internal.h index 89d725894..710a0eee2 100644 --- a/cogl/cogl-internal.h +++ b/cogl/cogl-internal.h @@ -25,6 +25,7 @@ #define __COGL_INTERNAL_H #include "cogl-bitmask.h" +#include "cogl-gl-header.h" #ifdef COGL_HAS_XLIB_SUPPORT #include diff --git a/cogl/cogl-sampler-cache-private.h b/cogl/cogl-sampler-cache-private.h index 7e1d17cd1..4eb750390 100644 --- a/cogl/cogl-sampler-cache-private.h +++ b/cogl/cogl-sampler-cache-private.h @@ -26,6 +26,7 @@ #define __COGL_SAMPLER_CACHE_PRIVATE_H #include "cogl-context.h" +#include "cogl-gl-header.h" /* GL_ALWAYS is just used here as a value that is known not to clash * with any valid GL wrap modes. diff --git a/cogl/cogl-shader-private.h b/cogl/cogl-shader-private.h index 6c05b3fb7..06575e6dd 100644 --- a/cogl/cogl-shader-private.h +++ b/cogl/cogl-shader-private.h @@ -26,6 +26,7 @@ #include "cogl-handle.h" #include "cogl-shader.h" +#include "cogl-gl-header.h" typedef struct _CoglShader CoglShader; diff --git a/cogl/cogl-texture.h b/cogl/cogl-texture.h index 4eeffb584..c73ea8a87 100644 --- a/cogl/cogl-texture.h +++ b/cogl/cogl-texture.h @@ -207,12 +207,12 @@ cogl_texture_new_from_data (unsigned int width, * Since: 0.8 */ CoglTexture * -cogl_texture_new_from_foreign (GLuint gl_handle, - GLenum gl_target, - GLuint width, - GLuint height, - GLuint x_pot_waste, - GLuint y_pot_waste, +cogl_texture_new_from_foreign (unsigned int gl_handle, + unsigned int gl_target, + unsigned int width, + unsigned int height, + unsigned int x_pot_waste, + unsigned int y_pot_waste, CoglPixelFormat format); /** @@ -353,8 +353,8 @@ cogl_texture_is_sliced (CoglTexture *texture); */ gboolean cogl_texture_get_gl_texture (CoglTexture *texture, - GLuint *out_gl_handle, - GLenum *out_gl_target); + unsigned int *out_gl_handle, + unsigned int *out_gl_target); /** * cogl_texture_get_data: diff --git a/cogl/tesselator/tesselator.h b/cogl/tesselator/tesselator.h index 69a6ecea5..5b651be1d 100644 --- a/cogl/tesselator/tesselator.h +++ b/cogl/tesselator/tesselator.h @@ -35,6 +35,7 @@ /* This just includes the defines needed by the tesselator code */ #include "cogl/cogl-defines.h" +#include "cogl/cogl-gl-header.h" typedef struct GLUtesselator GLUtesselator; diff --git a/configure.ac b/configure.ac index 700cd2b69..3f0a992d6 100644 --- a/configure.ac +++ b/configure.ac @@ -1120,6 +1120,7 @@ cogl/Makefile cogl/cogl-1.0.pc cogl/cogl-2.0-experimental.pc cogl/cogl-defines.h +cogl/cogl-gl-header.h cogl/cogl.rc cogl-pango/Makefile cogl-pango/cogl-pango-1.0.pc diff --git a/tests/conform/Makefile.am b/tests/conform/Makefile.am index 7de8305c7..9b656a66a 100644 --- a/tests/conform/Makefile.am +++ b/tests/conform/Makefile.am @@ -52,6 +52,7 @@ test_sources = \ test-write-texture-formats.c \ test-point-size.c \ test-point-sprite.c \ + test-no-gl-header.c \ $(NULL) test_conformance_SOURCES = $(common_sources) $(test_sources) diff --git a/tests/conform/test-no-gl-header.c b/tests/conform/test-no-gl-header.c new file mode 100644 index 000000000..49dae6cbe --- /dev/null +++ b/tests/conform/test-no-gl-header.c @@ -0,0 +1,17 @@ +#include + +#include "test-utils.h" + +/* If you just include cogl/cogl.h, you shouldn't end up including any + GL headers */ +#ifdef GL_TRUE +#error "Including cogl.h shouldn't be including any GL headers" +#endif + +void +test_no_gl_header (void) +{ + if (cogl_test_verbose ()) + g_print ("OK\n"); +} +