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.
This commit is contained in:
Neil Roberts 2010-07-01 20:34:59 +01:00
parent c019ff241d
commit 884df17536
3 changed files with 31 additions and 17 deletions

View File

@ -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));
}

View File

@ -24,3 +24,17 @@
that the tesselator code can still #include <GL/glu.h> */
#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

View File

@ -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