# set up stereo masks
        viewer.getCamera().setCullMask(0xffffffff)
        viewer.getCamera().setCullMaskLeft(0x00000001)
        viewer.getCamera().setCullMaskRight(0x00000002)

        viewer.getCamera().setViewport(osg.Viewport(0, 0, traits.width, traits.height))

        buffer =  GL_BACK if (traits.doubleBuffer) else  GL_FRONT

        viewer.getCamera().setDrawBuffer(buffer)
        viewer.getCamera().setReadBuffer(buffer)

    outputPath = osgDB.getFilePath(fc.getOutputFileName())
    if  not outputPath.empty() :
        type = osgDB.fileType(outputPath)
        switch(type)
            case(osgDB.FILE_NOT_FOUND):
                if  not osgDB.makeDirectory(outputPath) :
                    OSG_NOTICE, "Error: could not create directory [", outputPath, "]."                    
                    return 1
                OSG_NOTICE, "Created directory [", outputPath, "]."
                break
            case(osgDB.REGULAR_FILE):
                OSG_NOTICE, "Error: filepath for output files is regular file, not a directory as required."
                return 1
            case(osgDB.DIRECTORY):
                OSG_NOTICE, "Valid path[", outputPath, "] provided for output files."
                break

    pixelFormat =  GL_RGBA if ((fc.getPixelFormat()==gsc.CaptureSettings.RGBA)) else  GL_RGB
Example #2
0
    usage.addKeyboardMouseBinding("p","Play/Pause current movie")
    usage.addKeyboardMouseBinding("r","Restart current movie")
    usage.addKeyboardMouseBinding("l","Toggle looping of current movie")
    usage.addKeyboardMouseBinding("+","Increase speed of current movie")
    usage.addKeyboardMouseBinding("-","Decrease speed of current movie")
    usage.addKeyboardMouseBinding("o","Display frame rate of current movie")
    usage.addKeyboardMouseBinding(">","Advance the current movie using seek")


static osgDB.DirectoryContents getSuitableFiles(osg.ArgumentParser arguments)
    files = osgDB.DirectoryContents()
    for(int i=1 i<arguments.argc() ++i)
        if arguments.isOption(i) :
            continue

        if osgDB.fileType(arguments[i]) == osgDB.DIRECTORY :
            directory = arguments[i]
            dc = osgDB.getSortedDirectoryContents(directory)

            for(osgDB.DirectoryContents.iterator itr = dc.begin() itr  not = dc.end() ++itr)
                full_file_name = directory + "/" + (*itr)
                if osgDB.fileType(full_file_name)  not = osgDB.DIRECTORY :
                    files.push_back(full_file_name)
        else:
            files.push_back(arguments[i])
    return files


class MyDimensionsChangedCallback (osg.Image.DimensionsChangedCallback) :
    MyDimensionsChangedCallback(osg.Texture* tex, osg.Geometry* geo)
        : osg.Image.DimensionsChangedCallback()