Changeset 8257

Show
Ignore:
Timestamp:
04/28/08 23:29:11
Author:
robert
Message:

Implement graphics context exercise

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • OpenSceneGraph-TrainingMaterials/trunk/Sources/Exercises/08_viewer/8c_graphicscontexts/8c_graphicscontexts.cpp

    r8120 r8257  
    11#include <osg/ArgumentParser> 
    22#include <osgDB/ReadFile> 
     3#include <osgViewer/Viewer> 
    34 
    45#include <iostream> 
     
    67int main( int argc, char **argv ) 
    78{ 
    8     std::cout<<"TODO "<<argv[0]<<std::endl; 
     9    // The purpose of this exercise is to  
     10    // explore how to create graphics contexts 
     11    // and associate them with master camera. 
     12    // 
    913     
    10     return 0; 
     14    osgViewer::Viewer viewer; 
     15     
     16    viewer.setSceneData(osgDB::readNodeFile("glider.osg")); 
     17     
     18    { 
     19        // Create a graphics window origin at 100,100 size of 800, 600 
     20        // and assign it to the master camera. 
     21        // Hint - use GraphicsContext::Traits to specify traits of context 
     22        //      - use GraphicsContext::createGraphicsContext(trais) to create context 
     23        //      - use Camera::setGraphicsContext(context) to assign context 
     24    } 
     25     
     26    if (!viewer.getCamera()->getGraphicsContext()) 
     27    { 
     28        std::cout<<"Please assign GraphicsContext to Viewers master Camera."<<std::endl; 
     29        return 0; 
     30    } 
     31 
     32    return viewer.run(); 
    1133}