Esempio n. 1
0
int main()
{
	Scene scene;
    char* filename = "src/resources/scene.json";

    scene.parseScene(filename, scene);
    int width = 1024;
    int height = 768;
    Viewer *view = new Viewer(width, height, scene);
    view->display();
    return 0;
}
Esempio n. 2
0
void
MainThread::work() 
{
    setMaxHeartbeatInterval( 1.0 );

    // get 1 image
    // and check it's description for the particular image configuration
    getImage();
    
    //set up the viewer according to the configuration
    Viewer viewer = Viewer( imageData_->description->width,
                            imageData_->description->height,
                            imageData_->description->format,
                            context_ );

    while ( !isStopping() )
    {
        try 
        {
            // this blocks until a new image arrives and then
            // copies into a member variable
            getImage();
            
            // pass the image to the viewer
            viewer.display( imageData_ );
            
            //pushing too fast will cause the gui to not respond, sleep to prevent that
            // TODO: dodgy hack... needs to be fixed
            // The GUI diplay should be independent of incoming data. If the GUI dies,
            // then this code should be in the Viewer.
            IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(5));
        }
        catch ( ... ) 
        {
            orcaice::catchMainLoopExceptions( health() );

            // Re-create the viewer, unless we are stopping
            if ( !isStopping() ) {
                // TODO: make opencv window handle exception safe so we can create
                // another viewer here. At the moment, if an exception is thrown, 
                // the viewer will not self destruct. 
                // createViewer();
            }
        }

    } // end of while
}