Introduced osg namespace to new local GLU functions

This commit is contained in:
Robert Osfield
2010-10-07 11:53:28 +00:00
parent 12e6a23451
commit d23ce985a1
11 changed files with 54 additions and 123 deletions

View File

@@ -1003,7 +1003,7 @@ void Image::copySubImage(int s_offset, int t_offset, int r_offset, const osg::Im
PixelStorageModes psm;
psm.pack_alignment = _packing;
psm.pack_row_length = _packing;
psm.pack_row_length = _s;
psm.unpack_alignment = _packing;
GLint status = gluScaleImage(&psm, _pixelFormat,

View File

@@ -54,6 +54,7 @@
#define FALSE 0
#endif
/*ARGSUSED*/ static void GLAPIENTRY noBegin( GLenum type ) {}
/*ARGSUSED*/ static void GLAPIENTRY noEdgeFlag( GLboolean boundaryEdge ) {}
/*ARGSUSED*/ static void GLAPIENTRY noVertex( void *data ) {}
@@ -89,7 +90,7 @@ typedef struct { GLUhalfEdge e, eSym; } EdgePair;
GLUtesselator * GLAPIENTRY
gluNewTess( void )
osg::gluNewTess( void )
{
GLUtesselator *tess;
@@ -190,7 +191,7 @@ static void GotoState( GLUtesselator *tess, enum TessState newState )
void GLAPIENTRY
gluDeleteTess( GLUtesselator *tess )
osg::gluDeleteTess( GLUtesselator *tess )
{
RequireState( tess, T_DORMANT );
memFree( tess );
@@ -198,7 +199,7 @@ gluDeleteTess( GLUtesselator *tess )
void GLAPIENTRY
gluTessProperty( GLUtesselator *tess, GLenum which, GLdouble value )
osg::gluTessProperty( GLUtesselator *tess, GLenum which, GLdouble value )
{
GLenum windingRule;
@@ -237,7 +238,7 @@ gluTessProperty( GLUtesselator *tess, GLenum which, GLdouble value )
/* Returns tessellator property */
void GLAPIENTRY
gluGetTessProperty( GLUtesselator *tess, GLenum which, GLdouble *value )
osg::gluGetTessProperty( GLUtesselator *tess, GLenum which, GLdouble *value )
{
switch (which) {
case GLU_TESS_TOLERANCE:
@@ -265,7 +266,7 @@ gluGetTessProperty( GLUtesselator *tess, GLenum which, GLdouble *value )
} /* gluGetTessProperty() */
void GLAPIENTRY
gluTessNormal( GLUtesselator *tess, GLdouble x, GLdouble y, GLdouble z )
osg::gluTessNormal( GLUtesselator *tess, GLdouble x, GLdouble y, GLdouble z )
{
tess->normal[0] = x;
tess->normal[1] = y;
@@ -273,7 +274,7 @@ gluTessNormal( GLUtesselator *tess, GLdouble x, GLdouble y, GLdouble z )
}
void GLAPIENTRY
gluTessCallback( GLUtesselator *tess, GLenum which, _GLUfuncptr fn)
osg::gluTessCallback( GLUtesselator *tess, GLenum which, _GLUfuncptr fn)
{
switch( which ) {
case GLU_TESS_BEGIN:
@@ -412,7 +413,7 @@ static int EmptyCache( GLUtesselator *tess )
void GLAPIENTRY
gluTessVertex( GLUtesselator *tess, GLdouble coords[3], void *data )
osg::gluTessVertex( GLUtesselator *tess, GLdouble coords[3], void *data )
{
int i, tooLarge = FALSE;
GLdouble x, clamped[3];
@@ -459,7 +460,7 @@ gluTessVertex( GLUtesselator *tess, GLdouble coords[3], void *data )
void GLAPIENTRY
gluTessBeginPolygon( GLUtesselator *tess, void *data )
osg::gluTessBeginPolygon( GLUtesselator *tess, void *data )
{
RequireState( tess, T_DORMANT );
@@ -473,7 +474,7 @@ gluTessBeginPolygon( GLUtesselator *tess, void *data )
void GLAPIENTRY
gluTessBeginContour( GLUtesselator *tess )
osg::gluTessBeginContour( GLUtesselator *tess )
{
RequireState( tess, T_IN_POLYGON );
@@ -490,14 +491,14 @@ gluTessBeginContour( GLUtesselator *tess )
void GLAPIENTRY
gluTessEndContour( GLUtesselator *tess )
osg::gluTessEndContour( GLUtesselator *tess )
{
RequireState( tess, T_IN_CONTOUR );
tess->state = T_IN_POLYGON;
}
void GLAPIENTRY
gluTessEndPolygon( GLUtesselator *tess )
osg::gluTessEndPolygon( GLUtesselator *tess )
{
GLUmesh *mesh;
@@ -590,43 +591,3 @@ gluTessEndPolygon( GLUtesselator *tess )
tess->polygonData= NULL;
tess->mesh = NULL;
}
/*XXXblythe unused function*/
#if 0
void GLAPIENTRY
gluDeleteMesh( GLUmesh *mesh )
{
__gl_meshDeleteMesh( mesh );
}
#endif
/*******************************************************/
/* Obsolete calls -- for backward compatibility */
void GLAPIENTRY
gluBeginPolygon( GLUtesselator *tess )
{
gluTessBeginPolygon( tess, NULL );
gluTessBeginContour( tess );
}
/*ARGSUSED*/
void GLAPIENTRY
gluNextContour( GLUtesselator *tess, GLenum type )
{
gluTessEndContour( tess );
gluTessBeginContour( tess );
}
void GLAPIENTRY
gluEndPolygon( GLUtesselator *tess )
{
gluTessEndContour( tess );
gluTessEndPolygon( tess );
}

View File

@@ -46,7 +46,6 @@
#include "dict.h"
#include "priorityq.h"
/* The begin/end calls must be properly nested. We keep track of
* the current state to enforce the ordering.
*/
@@ -62,7 +61,7 @@ typedef struct CachedVertex {
void *data;
} CachedVertex;
struct GLUtesselator {
struct osg::GLUtesselator {
/*** state needed for collecting the input data ***/
@@ -168,4 +167,9 @@ void GLAPIENTRY __gl_noCombineData( GLdouble coords[3], void *data[4],
(*tess->callErrorData)((a),tess->polygonData); \
else (*tess->callError)((a));
// make it easy to introduce the namespace osg for the public functions and typedefs
using osg::GLUtesselator;
using osg::_GLUfuncptr;
#endif

View File

@@ -36,6 +36,9 @@
#define GL_TABLE_TOO_LARGE 0x8031
#endif
namespace osg
{
static unsigned char *__gluNurbsErrors[] = {
(unsigned char*) " ",
(unsigned char*) "spline order un-supported",
@@ -140,3 +143,4 @@ const GLubyte* gluErrorString(GLenum errorCode)
return (const GLubyte *) 0;
}
} // end of namespace osg

View File

@@ -50,6 +50,9 @@
#include <math.h>
#include <osg/Notify>
namespace osg
{
typedef union {
unsigned char ub[4];
unsigned short us[2];
@@ -8970,3 +8973,4 @@ static void halveImage3D(int components,
/*** mipmap.c ***/
} // end of namespace osg

View File

@@ -44,15 +44,15 @@ bool Tessellator::tessellate(const Polygon &poly, const osg::Vec3Array *points,
out_ = out;
last_error_ = 0;
GLUtesselator *tess = gluNewTess();
osg::GLUtesselator *tess = osg::gluNewTess();
gluTessCallback(tess, GLU_TESS_BEGIN_DATA, (GLU_TESS_CALLBACK) (cb_begin_data));
gluTessCallback(tess, GLU_TESS_VERTEX_DATA, (GLU_TESS_CALLBACK) (cb_vertex_data));
gluTessCallback(tess, GLU_TESS_END_DATA, (GLU_TESS_CALLBACK) (cb_end_data));
gluTessCallback(tess, GLU_TESS_ERROR_DATA, (GLU_TESS_CALLBACK) (cb_error_data));
osg::gluTessCallback(tess, GLU_TESS_BEGIN_DATA, (osg::GLU_TESS_CALLBACK) (cb_begin_data));
osg::gluTessCallback(tess, GLU_TESS_VERTEX_DATA, (osg::GLU_TESS_CALLBACK) (cb_vertex_data));
osg::gluTessCallback(tess, GLU_TESS_END_DATA, (osg::GLU_TESS_CALLBACK) (cb_end_data));
osg::gluTessCallback(tess, GLU_TESS_ERROR_DATA, (osg::GLU_TESS_CALLBACK) (cb_error_data));
gluTessBeginPolygon(tess, this);
gluTessBeginContour(tess);
osg::gluTessBeginPolygon(tess, this);
osg::gluTessBeginContour(tess);
double *vertices = new double[poly.indices().size() * 3];
int *indices = new int[poly.indices().size()];
@@ -72,9 +72,9 @@ bool Tessellator::tessellate(const Polygon &poly, const osg::Vec3Array *points,
gluTessVertex(tess, v, x);
}
gluTessEndContour(tess);
gluTessEndPolygon(tess);
gluDeleteTess(tess);
osg::gluTessEndContour(tess);
osg::gluTessEndPolygon(tess);
osg::gluDeleteTess(tess);
delete[] vertices;
delete[] indices;

View File

@@ -434,7 +434,7 @@ void Glyph::subload() const
GLenum errorNo = glGetError();
if (errorNo!=GL_NO_ERROR)
{
const GLubyte* msg = gluErrorString(errorNo);
const GLubyte* msg = osg::gluErrorString(errorNo);
if (msg) { OSG_WARN<<"before Glyph::subload(): detected OpenGL error: "<<msg<<std::endl; }
else { OSG_WARN<<"before Glyph::subload(): detected OpenGL error number: "<<errorNo<<std::endl; }
}
@@ -459,7 +459,7 @@ void Glyph::subload() const
{
const GLubyte* msg = gluErrorString(errorNo);
const GLubyte* msg = osg::gluErrorString(errorNo);
if (msg) { OSG_WARN<<"after Glyph::subload() : detected OpenGL error: "<<msg<<std::endl; }
else { OSG_WARN<<"after Glyph::subload() : detected OpenGL error number: "<<errorNo<<std::endl; }