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

Introduced osg namespace to new local GLU functions

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • 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.