Changeset 11829

Show
Ignore:
Timestamp:
10/07/10 13:53:28 (3 years ago)
Author:
robert
Message:

Introduced osg namespace to new local GLU functions

Location:
OpenSceneGraph/trunk
Files:
11 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgphotoalbum/PhotoArchive.cpp

    r11828 r11829  
    216216            } 
    217217 
    218             PixelStorageModes psm; 
     218            osg::PixelStorageModes psm; 
    219219            psm.pack_alignment = image->getPacking(); 
    220220            psm.unpack_alignment = image->getPacking(); 
    221221 
    222             GLint status = gluScaleImage(&psm, image->getPixelFormat(), 
     222            GLint status = osg::gluScaleImage(&psm, image->getPixelFormat(), 
    223223                image->s(), 
    224224                image->t(), 
     
    234234               delete [] newData; 
    235235 
    236                 osg::notify(osg::WARN) << "Error scaleImage() did not succeed : errorString = "<<gluErrorString((GLenum)status)<<std::endl; 
     236                osg::notify(osg::WARN) << "Error scaleImage() did not succeed : errorString = "<<osg::gluErrorString((GLenum)status)<<std::endl; 
    237237            } 
    238238     
     
    283283            } 
    284284 
    285             PixelStorageModes psm; 
     285            osg::PixelStorageModes psm; 
    286286            psm.pack_alignment = image->getPacking(); 
    287287            psm.unpack_alignment = image->getPacking(); 
    288288 
    289             GLint status = gluScaleImage(&psm, image->getPixelFormat(), 
     289            GLint status = osg::gluScaleImage(&psm, image->getPixelFormat(), 
    290290                image->s(), 
    291291                image->t(), 
     
    301301               delete [] newData; 
    302302 
    303                 osg::notify(osg::WARN) << "Error scaleImage() did not succeed : errorString = "<<gluErrorString((GLenum)status)<<std::endl; 
     303                osg::notify(osg::WARN) << "Error scaleImage() did not succeed : errorString = "<<osg::gluErrorString((GLenum)status)<<std::endl; 
    304304            } 
    305305 
  • OpenSceneGraph/trunk/examples/osgtexture3D/osgtexture3D.cpp

    r6941 r11829  
    3939typedef std::vector< osg::ref_ptr<osg::Image> > ImageList; 
    4040 
    41  
    42 class MyGraphicsContext { 
    43     public: 
    44         MyGraphicsContext() 
    45         { 
    46             osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits; 
    47             traits->x = 0; 
    48             traits->y = 0; 
    49             traits->width = 1; 
    50             traits->height = 1; 
    51             traits->windowDecoration = false; 
    52             traits->doubleBuffer = false; 
    53             traits->sharedContext = 0; 
    54             traits->pbuffer = true; 
    55  
    56             _gc = osg::GraphicsContext::createGraphicsContext(traits.get()); 
    57  
    58             if (!_gc) 
    59             { 
    60                 traits->pbuffer = false; 
    61                 _gc = osg::GraphicsContext::createGraphicsContext(traits.get()); 
    62             } 
    63  
    64             if (_gc.valid())  
    65             { 
    66                 _gc->realize(); 
    67                 _gc->makeCurrent(); 
    68             } 
    69         } 
    70          
    71         bool valid() const { return _gc.valid() && _gc->isRealized(); } 
    72          
    73     private: 
    74         osg::ref_ptr<osg::GraphicsContext> _gc; 
    75 }; 
    76  
    77  
    7841osg::StateSet* createState() 
    7942{ 
    80     MyGraphicsContext gc; 
    81     if (!gc.valid())  
    82     { 
    83         osg::notify(osg::NOTICE)<<"Unable to create the graphics context required to build 3d image."<<std::endl; 
    84         return 0; 
    85     } 
    86  
    8743    // read 4 2d images 
    8844    osg::ref_ptr<osg::Image> image_0 = osgDB::readImageFile("Images/lz.rgb"); 
     
    10359    } 
    10460 
    105     // get max 3D texture size 
    106     GLint textureSize = osg::Texture3D::getExtensions(0,true)->maxTexture3DSize(); 
    107     if (textureSize > 256) 
    108         textureSize = 256; 
     61    GLint textureSize = 256; 
    10962 
    11063    // scale them all to the same size. 
  • OpenSceneGraph/trunk/include/osg/GLU

    r11828 r11829  
    1616 
    1717#include <osg/GL> 
     18 
     19namespace osg 
     20{ 
    1821 
    1922/* Pixel storage modes, used by gluScaleImage */ 
     
    164167 
    165168extern OSG_EXPORT void gluTessBeginContour (GLUtesselator* tess); 
    166 extern OSG_EXPORT void gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data); 
    167169extern OSG_EXPORT void gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc); 
    168170extern OSG_EXPORT void gluTessEndContour (GLUtesselator* tess); 
    169 extern OSG_EXPORT void gluTessEndPolygon (GLUtesselator* tess); 
    170171extern OSG_EXPORT void gluTessNormal (GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ); 
    171172extern OSG_EXPORT void gluTessProperty (GLUtesselator* tess, GLenum which, GLdouble data); 
    172173extern OSG_EXPORT void gluTessVertex (GLUtesselator* tess, GLdouble *location, GLvoid* data); 
     174extern OSG_EXPORT void gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data); 
     175extern OSG_EXPORT void gluTessEndPolygon (GLUtesselator* tess); 
     176extern OSG_EXPORT void gluGetTessProperty( GLUtesselator *tess, GLenum which, GLdouble *value ); 
    173177 
     178} 
    174179 
    175180#endif  // __osgGLU_h 
  • OpenSceneGraph/trunk/include/osgUtil/Tessellator

    r11817 r11829  
    211211        typedef std::vector<Vec3d*> Vec3dList; 
    212212 
    213         GLUtesselator*  _tobj; 
     213        osg::GLUtesselator*  _tobj; 
    214214 
    215215        PrimList        _primList; 
  • OpenSceneGraph/trunk/src/osg/Image.cpp

    r11828 r11829  
    10041004    PixelStorageModes psm; 
    10051005    psm.pack_alignment = _packing; 
    1006     psm.pack_row_length = _packing; 
     1006    psm.pack_row_length = _s; 
    10071007    psm.unpack_alignment = _packing; 
    10081008 
  • OpenSceneGraph/trunk/src/osg/glu/libtess/tess.cpp

    r11818 r11829  
    5555#endif 
    5656 
     57 
    5758/*ARGSUSED*/ static void GLAPIENTRY noBegin( GLenum type ) {} 
    5859/*ARGSUSED*/ static void GLAPIENTRY noEdgeFlag( GLboolean boundaryEdge ) {} 
     
    9091 
    9192GLUtesselator * GLAPIENTRY 
    92 gluNewTess( void ) 
     93osg::gluNewTess( void ) 
    9394{ 
    9495  GLUtesselator *tess; 
     
    191192 
    192193void GLAPIENTRY 
    193 gluDeleteTess( GLUtesselator *tess ) 
     194osg::gluDeleteTess( GLUtesselator *tess ) 
    194195{ 
    195196  RequireState( tess, T_DORMANT ); 
     
    199200 
    200201void GLAPIENTRY 
    201 gluTessProperty( GLUtesselator *tess, GLenum which, GLdouble value ) 
     202osg::gluTessProperty( GLUtesselator *tess, GLenum which, GLdouble value ) 
    202203{ 
    203204  GLenum windingRule; 
     
    238239/* Returns tessellator property */ 
    239240void GLAPIENTRY 
    240 gluGetTessProperty( GLUtesselator *tess, GLenum which, GLdouble *value ) 
     241osg::gluGetTessProperty( GLUtesselator *tess, GLenum which, GLdouble *value ) 
    241242{ 
    242243   switch (which) { 
     
    266267 
    267268void GLAPIENTRY 
    268 gluTessNormal( GLUtesselator *tess, GLdouble x, GLdouble y, GLdouble z ) 
     269osg::gluTessNormal( GLUtesselator *tess, GLdouble x, GLdouble y, GLdouble z ) 
    269270{ 
    270271  tess->normal[0] = x; 
     
    274275 
    275276void GLAPIENTRY 
    276 gluTessCallback( GLUtesselator *tess, GLenum which, _GLUfuncptr fn) 
     277osg::gluTessCallback( GLUtesselator *tess, GLenum which, _GLUfuncptr fn) 
    277278{ 
    278279  switch( which ) { 
     
    413414 
    414415void GLAPIENTRY 
    415 gluTessVertex( GLUtesselator *tess, GLdouble coords[3], void *data ) 
     416osg::gluTessVertex( GLUtesselator *tess, GLdouble coords[3], void *data ) 
    416417{ 
    417418  int i, tooLarge = FALSE; 
     
    460461 
    461462void GLAPIENTRY 
    462 gluTessBeginPolygon( GLUtesselator *tess, void *data ) 
     463osg::gluTessBeginPolygon( GLUtesselator *tess, void *data ) 
    463464{ 
    464465  RequireState( tess, T_DORMANT ); 
     
    474475 
    475476void GLAPIENTRY 
    476 gluTessBeginContour( GLUtesselator *tess ) 
     477osg::gluTessBeginContour( GLUtesselator *tess ) 
    477478{ 
    478479  RequireState( tess, T_IN_POLYGON ); 
     
    491492 
    492493void GLAPIENTRY 
    493 gluTessEndContour( GLUtesselator *tess ) 
     494osg::gluTessEndContour( GLUtesselator *tess ) 
    494495{ 
    495496  RequireState( tess, T_IN_CONTOUR ); 
     
    498499 
    499500void GLAPIENTRY 
    500 gluTessEndPolygon( GLUtesselator *tess ) 
     501osg::gluTessEndPolygon( GLUtesselator *tess ) 
    501502{ 
    502503  GLUmesh *mesh; 
     
    591592  tess->mesh = NULL; 
    592593} 
    593  
    594  
    595 /*XXXblythe unused function*/ 
    596 #if 0 
    597 void GLAPIENTRY 
    598 gluDeleteMesh( GLUmesh *mesh ) 
    599 { 
    600   __gl_meshDeleteMesh( mesh ); 
    601 } 
    602 #endif 
    603  
    604  
    605  
    606 /*******************************************************/ 
    607  
    608 /* Obsolete calls -- for backward compatibility */ 
    609  
    610 void GLAPIENTRY 
    611 gluBeginPolygon( GLUtesselator *tess ) 
    612 { 
    613   gluTessBeginPolygon( tess, NULL ); 
    614   gluTessBeginContour( tess ); 
    615 } 
    616  
    617  
    618 /*ARGSUSED*/ 
    619 void GLAPIENTRY 
    620 gluNextContour( GLUtesselator *tess, GLenum type ) 
    621 { 
    622   gluTessEndContour( tess ); 
    623   gluTessBeginContour( tess ); 
    624 } 
    625  
    626  
    627 void GLAPIENTRY 
    628 gluEndPolygon( GLUtesselator *tess ) 
    629 { 
    630   gluTessEndContour( tess ); 
    631   gluTessEndPolygon( tess ); 
    632 } 
  • OpenSceneGraph/trunk/src/osg/glu/libtess/tess.h

    r11822 r11829  
    4747#include "priorityq.h" 
    4848 
    49  
    5049/* The begin/end calls must be properly nested.  We keep track of 
    5150 * the current state to enforce the ordering. 
     
    6362} CachedVertex; 
    6463 
    65 struct GLUtesselator { 
     64struct osg::GLUtesselator { 
    6665 
    6766  /*** state needed for collecting the input data ***/ 
     
    169168   else (*tess->callError)((a)); 
    170169 
     170// make it easy to introduce the namespace osg for the public functions and typedefs 
     171using osg::GLUtesselator; 
     172using osg::_GLUfuncptr; 
     173 
     174 
    171175#endif 
  • OpenSceneGraph/trunk/src/osg/glu/libutil/error.cpp

    r11821 r11829  
    3636    #define GL_TABLE_TOO_LARGE  0x8031 
    3737#endif 
     38 
     39namespace osg 
     40{ 
    3841 
    3942static unsigned char *__gluNurbsErrors[] = { 
     
    141144} 
    142145 
     146} // end of namespace osg 
  • OpenSceneGraph/trunk/src/osg/glu/libutil/mipmap.cpp

    r11828 r11829  
    5050#include <math.h> 
    5151#include <osg/Notify> 
     52 
     53namespace osg 
     54{ 
    5255 
    5356typedef union { 
     
    89718974/*** mipmap.c ***/ 
    89728975 
     8976} // end of namespace osg 
  • OpenSceneGraph/trunk/src/osgPlugins/lwo/Tessellator.cpp

    r4801 r11829  
    4545    last_error_ = 0; 
    4646 
    47     GLUtesselator *tess = gluNewTess(); 
     47    osg::GLUtesselator *tess = osg::gluNewTess(); 
    4848 
    49     gluTessCallback(tess, GLU_TESS_BEGIN_DATA, (GLU_TESS_CALLBACK) (cb_begin_data)); 
    50     gluTessCallback(tess, GLU_TESS_VERTEX_DATA, (GLU_TESS_CALLBACK) (cb_vertex_data)); 
    51     gluTessCallback(tess, GLU_TESS_END_DATA, (GLU_TESS_CALLBACK) (cb_end_data)); 
    52     gluTessCallback(tess, GLU_TESS_ERROR_DATA, (GLU_TESS_CALLBACK) (cb_error_data)); 
     49    osg::gluTessCallback(tess, GLU_TESS_BEGIN_DATA, (osg::GLU_TESS_CALLBACK) (cb_begin_data)); 
     50    osg::gluTessCallback(tess, GLU_TESS_VERTEX_DATA, (osg::GLU_TESS_CALLBACK) (cb_vertex_data)); 
     51    osg::gluTessCallback(tess, GLU_TESS_END_DATA, (osg::GLU_TESS_CALLBACK) (cb_end_data)); 
     52    osg::gluTessCallback(tess, GLU_TESS_ERROR_DATA, (osg::GLU_TESS_CALLBACK) (cb_error_data)); 
    5353 
    54     gluTessBeginPolygon(tess, this); 
    55     gluTessBeginContour(tess);     
     54    osg::gluTessBeginPolygon(tess, this); 
     55    osg::gluTessBeginContour(tess);     
    5656 
    5757    double *vertices = new double[poly.indices().size() * 3]; 
     
    7373    } 
    7474 
    75     gluTessEndContour(tess); 
    76     gluTessEndPolygon(tess); 
    77     gluDeleteTess(tess); 
     75    osg::gluTessEndContour(tess); 
     76    osg::gluTessEndPolygon(tess); 
     77    osg::gluDeleteTess(tess); 
    7878 
    7979    delete[] vertices; 
  • OpenSceneGraph/trunk/src/osgText/Glyph.cpp

    r11817 r11829  
    435435    if (errorNo!=GL_NO_ERROR) 
    436436    { 
    437         const GLubyte* msg = gluErrorString(errorNo); 
     437        const GLubyte* msg = osg::gluErrorString(errorNo); 
    438438        if (msg) { OSG_WARN<<"before Glyph::subload(): detected OpenGL error: "<<msg<<std::endl; } 
    439439        else  { OSG_WARN<<"before Glyph::subload(): detected OpenGL error number: "<<errorNo<<std::endl; } 
     
    460460 
    461461 
    462         const GLubyte* msg = gluErrorString(errorNo); 
     462        const GLubyte* msg = osg::gluErrorString(errorNo); 
    463463        if (msg) { OSG_WARN<<"after Glyph::subload() : detected OpenGL error: "<<msg<<std::endl; } 
    464464        else { OSG_WARN<<"after Glyph::subload() : detected OpenGL error number: "<<errorNo<<std::endl; }