From 0580dbe015768d63a856b91718652717b4c6b2f9 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Thu, 12 Mar 2009 13:34:36 +0000 Subject: [PATCH] Finish GLES{1,2} support for client side matrix stacks Adds glFrustum wrappers (GLES only accepts floats not doubles, and GLES2 needs to use our internal cogl_wrap_glFrustumf) Adds GL_TEXTURE_MATRIX getter code in cogl_wrap_glGetFloatv Adds a GL_TEXTURE_MATRIX define for GLES2 --- clutter/cogl/common/cogl-current-matrix.c | 13 +++++++++++++ clutter/cogl/gles/cogl-gles2-wrapper.c | 10 ++++++++++ clutter/cogl/gles/cogl-gles2-wrapper.h | 1 + 3 files changed, 24 insertions(+) diff --git a/clutter/cogl/common/cogl-current-matrix.c b/clutter/cogl/common/cogl-current-matrix.c index 7563c8c..1ccb4c6 100644 --- a/clutter/cogl/common/cogl-current-matrix.c +++ b/clutter/cogl/common/cogl-current-matrix.c @@ -33,6 +33,19 @@ #include "cogl-current-matrix.h" #include "cogl-matrix-stack.h" +#ifdef HAVE_COGL_GLES2 +#include "cogl-gles2-wrapper.h" + +#define glFrustum(L,R,B,T,N,F) \ + cogl_wrap_glFrustumf((GLfloat)L, (GLfloat)R, (GLfloat)B, \ + (GLfloat)T, (GLfloat)N, (GLfloat)F) +#elif defined (HAVE_COGL_GLES) + +#define glFrustum(L,R,B,T,N,F) \ + glFrustumf((GLfloat)L, (GLfloat)R, (GLfloat)B, \ + (GLfloat)T, (GLfloat)N, (GLfloat)F) +#endif + #include #include diff --git a/clutter/cogl/gles/cogl-gles2-wrapper.c b/clutter/cogl/gles/cogl-gles2-wrapper.c index 7f4ebbe..54a1d8c 100644 --- a/clutter/cogl/gles/cogl-gles2-wrapper.c +++ b/clutter/cogl/gles/cogl-gles2-wrapper.c @@ -1505,6 +1505,8 @@ cogl_wrap_glGetIntegerv (GLenum pname, GLint *params) void cogl_wrap_glGetFloatv (GLenum pname, GLfloat *params) { + CoglGles2WrapperTextureUnit *texture_unit; + _COGL_GET_GLES2_WRAPPER (w, NO_RETVAL); switch (pname) @@ -1519,6 +1521,14 @@ cogl_wrap_glGetFloatv (GLenum pname, GLfloat *params) sizeof (GLfloat) * 16); break; + case GL_TEXTURE_MATRIX: + texture_unit = w->texture_units + w->active_texture_unit; + memcpy (params, + texture_unit->texture_stack + + texture_unit->texture_stack_pos * 16, + sizeof (GLfloat) * 16); + break; + case GL_VIEWPORT: glGetFloatv (GL_VIEWPORT, params); break; diff --git a/clutter/cogl/gles/cogl-gles2-wrapper.h b/clutter/cogl/gles/cogl-gles2-wrapper.h index ec6860b..4d4fd1a 100644 --- a/clutter/cogl/gles/cogl-gles2-wrapper.h +++ b/clutter/cogl/gles/cogl-gles2-wrapper.h @@ -255,6 +255,7 @@ struct _CoglGles2WrapperShader #define GL_MODELVIEW_MATRIX 0x0BA6 #define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_TEXTURE_MATRIX 0x0BA8 #define GL_GENERATE_MIPMAP 0x8191 -- 2.7.4