From 4ff00fa1916ae4c6b446c5d815e09fbe53710d92 Mon Sep 17 00:00:00 2001 From: Matthew Allum Date: Fri, 26 Oct 2007 22:06:45 +0000 Subject: [PATCH] 2007-10-26 Matthew Allum * clutter/clutter-texture.c: * clutter/cogl/cogl.h: * clutter/cogl/gl/cogl-defines.h: * clutter/cogl/gles/cogl-defines.h: * clutter/cogl/gl/cogl.c: * clutter/cogl/gles/cogl.c: Switch from use of guint to COGLuint. Avoids problems when guint != GLuint on some platforms, i.e OSX. (Tommi Komulainen, #526) * clutter/Makefile.am: * clutter/osx/Makefile.am: * clutter/osx/clutter-backend-osx.c: * clutter/osx/clutter-backend-osx.h: * clutter/osx/clutter-event-osx.c: * clutter/osx/clutter-osx.h: * clutter/osx/clutter-stage-osx.c: * clutter/osx/clutter-stage-osx.h: * configure.ac: Add initial Cocoa/OSX Backend (by Tommi Komulainen, see #526) --- cogl.h | 11 ++++------- gl/cogl-defines.h | 9 +++++++++ gl/cogl.c | 35 +++++++++++++++++++++-------------- gles/cogl-defines.h | 1 + gles/cogl.c | 6 +++--- 5 files changed, 38 insertions(+), 24 deletions(-) diff --git a/cogl.h b/cogl.h index 66d55fe4c..80e512e5d 100644 --- a/cogl.h +++ b/cogl.h @@ -43,10 +43,7 @@ #define __COGL_H__ #include -#include -#include -#include -#include +#include #include "cogl-defines.h" @@ -133,13 +130,13 @@ cogl_texture_quad (gint x1, ClutterFixed ty2); void -cogl_textures_create (guint num, guint *textures); +cogl_textures_create (guint num, COGLuint *textures); void -cogl_textures_destroy (guint num, const guint *textures); +cogl_textures_destroy (guint num, const COGLuint *textures); void -cogl_texture_bind (COGLenum target, guint texture); +cogl_texture_bind (COGLenum target, COGLuint texture); void cogl_texture_set_alignment (COGLenum target, diff --git a/gl/cogl-defines.h b/gl/cogl-defines.h index e5e8ba482..47fde3d73 100644 --- a/gl/cogl-defines.h +++ b/gl/cogl-defines.h @@ -27,16 +27,25 @@ #define __COGL_DEFINES_H__ #ifdef WIN32 + #include #include + #else + +#if defined(HAVE_GL_GL_H) #include +#elif defined(HAVE_OPENGL_GL_H) +#include #endif +#endif /* WIN32 */ + G_BEGIN_DECLS typedef GLenum COGLenum; typedef GLint COGLint; +typedef GLuint COGLuint; /* FIXME + DOCUMENT */ diff --git a/gl/cogl.c b/gl/cogl.c index 6d2876a2d..c20923447 100644 --- a/gl/cogl.c +++ b/gl/cogl.c @@ -29,12 +29,6 @@ #include "cogl.h" -#ifdef WIN32 -#include -#include -#else -#include -#endif #include #ifdef HAVE_CLUTTER_GLX @@ -333,7 +327,7 @@ cogl_texture_can_size (COGLenum target, #ifdef GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB if (target == CGL_TEXTURE_RECTANGLE_ARB) { - gint max_size = 0; + GLint max_size = 0; GE( glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB, &max_size) ); @@ -381,19 +375,19 @@ cogl_texture_quad (gint x1, } void -cogl_textures_create (guint num, guint *textures) +cogl_textures_create (guint num, COGLuint *textures) { GE( glGenTextures (num, textures) ); } void -cogl_textures_destroy (guint num, const guint *textures) +cogl_textures_destroy (guint num, const COGLuint *textures) { GE( glDeleteTextures (num, textures) ); } void -cogl_texture_bind (COGLenum target, guint texture) +cogl_texture_bind (COGLenum target, COGLuint texture) { GE( glBindTexture (target, texture) ); } @@ -696,12 +690,25 @@ cogl_get_viewport (ClutterFixed v[4]) void cogl_get_bitmasks (gint *red, gint *green, gint *blue, gint *alpha) { + GLint value; if (red) - GE( glGetIntegerv(GL_RED_BITS, red) ); + { + GE( glGetIntegerv(GL_RED_BITS, &value) ); + *red = value; + } if (green) - GE( glGetIntegerv(GL_GREEN_BITS, green) ); + { + GE( glGetIntegerv(GL_GREEN_BITS, &value) ); + *green = value; + } if (blue) - GE( glGetIntegerv(GL_BLUE_BITS, blue) ); + { + GE( glGetIntegerv(GL_BLUE_BITS, &value) ); + *blue = value; + } if (alpha) - GE( glGetIntegerv(GL_ALPHA_BITS, alpha ) ); + { + GE( glGetIntegerv(GL_ALPHA_BITS, &value ) ); + *alpha = value; + } } diff --git a/gles/cogl-defines.h b/gles/cogl-defines.h index 37a9ab0ab..41eac1532 100644 --- a/gles/cogl-defines.h +++ b/gles/cogl-defines.h @@ -439,6 +439,7 @@ G_BEGIN_DECLS typedef GLenum COGLenum; typedef GLint COGLint; +typedef GLuint COGLuint; /* extras */ diff --git a/gles/cogl.c b/gles/cogl.c index 8a64d4c62..e6e688089 100644 --- a/gles/cogl.c +++ b/gles/cogl.c @@ -323,19 +323,19 @@ cogl_texture_quad (gint x1, } void -cogl_textures_create (guint num, guint *textures) +cogl_textures_create (guint num, COGLuint *textures) { GE( glGenTextures (num, textures) ); } void -cogl_textures_destroy (guint num, const guint *textures) +cogl_textures_destroy (guint num, const COGLuint *textures) { GE( glDeleteTextures (num, textures) ); } void -cogl_texture_bind (COGLenum target, guint texture) +cogl_texture_bind (COGLenum target, COGLuint texture) { GE( glBindTexture (target, texture) ); }