From 884df17536a11c092880392232ecc7c5b71f39a7 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Thu, 1 Jul 2010 20:34:59 +0100 Subject: [PATCH] Fix building the tesselator code for GLES The tesselator code uses some defines that it expects to be in the GL headers such as GLAPI and GLAPIENTRY. These are used to mark the entry points as exportable on each platform. We don't really want the tesselator code to use these but we also don't want to modify the C files so instead they are #defined to be empty in the stub glu.h. That header is only included internally when building the tesselator/ files so it shouldn't affect the rest of Cogl. GLES also doesn't have a GLdouble type so we just #define this to be a regular double. --- clutter/cogl/cogl/cogl-path.c | 4 +-- clutter/cogl/cogl/tesselator/GL/glu.h | 14 +++++++++++ clutter/cogl/cogl/tesselator/tesselator.h | 30 +++++++++++------------ 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/clutter/cogl/cogl/cogl-path.c b/clutter/cogl/cogl/cogl-path.c index 687fdaa15..e035ccb4c 100644 --- a/clutter/cogl/cogl/cogl-path.c +++ b/clutter/cogl/cogl/cogl-path.c @@ -1310,7 +1310,7 @@ _cogl_path_tesselator_end (CoglPathTesselator *tess) } static void -_cogl_path_tesselator_combine (GLdouble coords[3], +_cogl_path_tesselator_combine (double coords[3], void *vertex_data[4], GLfloat weight[4], void **out_data, @@ -1461,7 +1461,7 @@ _cogl_path_build_vbo (CoglPath *path) for (i = 0; i < node->path_size; i++) { - GLdouble vertex[3] = { node[i].x, node[i].y, 0.0 }; + double vertex[3] = { node[i].x, node[i].y, 0.0 }; gluTessVertex (tess.glu_tess, vertex, GINT_TO_POINTER (i + path_start)); } diff --git a/clutter/cogl/cogl/tesselator/GL/glu.h b/clutter/cogl/cogl/tesselator/GL/glu.h index c6c847b58..026ca5af7 100644 --- a/clutter/cogl/cogl/tesselator/GL/glu.h +++ b/clutter/cogl/cogl/tesselator/GL/glu.h @@ -24,3 +24,17 @@ that the tesselator code can still #include */ #include "../tesselator.h" + +/* These aren't defined on GLES and we don't really want the + tesselator code to use them but we're also trying to avoid + modifying the C files so we just force them to be empty here */ + +#undef GLAPI +#define GLAPI + +#undef GLAPIENTRY +#define GLAPIENTRY + +/* GLES doesn't define a GLdouble type so lets just force it to a + regular double */ +#define GLdouble double diff --git a/clutter/cogl/cogl/tesselator/tesselator.h b/clutter/cogl/cogl/tesselator/tesselator.h index 48fb25e45..69a6ecea5 100644 --- a/clutter/cogl/cogl/tesselator/tesselator.h +++ b/clutter/cogl/cogl/tesselator/tesselator.h @@ -40,25 +40,25 @@ typedef struct GLUtesselator GLUtesselator; #define GLU_TESS_MAX_COORD 1.0e150 -GLAPI void GLAPIENTRY gluBeginPolygon (GLUtesselator* tess); -GLAPI void GLAPIENTRY gluDeleteTess (GLUtesselator* tess); -GLAPI void GLAPIENTRY gluEndPolygon (GLUtesselator* tess); +void gluBeginPolygon (GLUtesselator* tess); +void gluDeleteTess (GLUtesselator* tess); +void gluEndPolygon (GLUtesselator* tess); -typedef void (GLAPIENTRYP _GLUfuncptr)(); +typedef void (_GLUfuncptr)(); -GLAPI void GLAPIENTRY gluGetTessProperty (GLUtesselator* tess, GLenum which, GLdouble* data); +void gluGetTessProperty (GLUtesselator* tess, GLenum which, double* data); -GLAPI GLUtesselator* GLAPIENTRY gluNewTess (void); -GLAPI void GLAPIENTRY gluNextContour (GLUtesselator* tess, GLenum type); +GLUtesselator *gluNewTess (void); +void gluNextContour (GLUtesselator* tess, GLenum type); -GLAPI void GLAPIENTRY gluTessBeginContour (GLUtesselator* tess); -GLAPI void GLAPIENTRY gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data); -GLAPI void GLAPIENTRY gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc); -GLAPI void GLAPIENTRY gluTessEndContour (GLUtesselator* tess); -GLAPI void GLAPIENTRY gluTessEndPolygon (GLUtesselator* tess); -GLAPI void GLAPIENTRY gluTessNormal (GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ); -GLAPI void GLAPIENTRY gluTessProperty (GLUtesselator* tess, GLenum which, GLdouble data); -GLAPI void GLAPIENTRY gluTessVertex (GLUtesselator* tess, GLdouble *location, GLvoid* data); +void gluTessBeginContour (GLUtesselator* tess); +void gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data); +void gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc); +void gluTessEndContour (GLUtesselator* tess); +void gluTessEndPolygon (GLUtesselator* tess); +void gluTessNormal (GLUtesselator* tess, double valueX, double valueY, double valueZ); +void gluTessProperty (GLUtesselator* tess, GLenum which, double data); +void gluTessVertex (GLUtesselator* tess, double *location, GLvoid* data); /* ErrorCode */ #define GLU_INVALID_ENUM 100900