Ejemplo n.º 1
0
    def createContext (self):
        """create a opengl context (currently WindowData classes are not wrapped so we can not inherrit the windowdata) """
        traits = osg.Traits()
        traits.readDISPLAY()
        if (traits.displayNum<0): traits.displayNum = 0

        traits.windowName = "osgViewerPyQt"
        traits.screenNum = 0
        traits.x = self.x()
        traits.y = self.y()
        traits.width = self.width()
        traits.height = self.height()
        traits.windowDecoration = False
        traits.doubleBuffer = True
        gw = osgViewer.GraphicsWindowEmbedded(traits)
        return gw
Ejemplo n.º 2
0
    def createContext(self):
        """create a opengl context (currently WindowData classes are not wrapped so we can not inherrit the windowdata) """
        ds = osg.DisplaySettings_instance()
        traits = osg.Traits()
        traits.readDISPLAY()
        if (traits.displayNum < 0): traits.displayNum = 0

        traits.windowName = "osgViewerPyQt"
        traits.screenNum = 0
        traits.x = self.x()
        traits.y = self.y()
        traits.width = self.width()
        traits.height = self.height()
        traits.alpha = ds.getMinimumNumAlphaBits()
        traits.stencil = ds.getMinimumNumStencilBits()
        traits.windowDecoration = False
        traits.doubleBuffer = True
        traits.sampleBuffers = ds.getMultiSamples()
        traits.samples = ds.getNumMultiSamples()
        gw = osgViewer.GraphicsWindowEmbedded(traits)
        return gw
Ejemplo n.º 3
0
    def setup_osgwindow(self, x, y, width, height):
        """
        pythonic alternative to setUpViewerAsEmbeddedInWindow
        """

        self.traits = osg.GraphicsContext.Traits()
        self.traits.x = x
        self.traits.y = y
        self.traits.width = width
        self.traits.height = height

        #stereo is possible:
        # self.traits.quadBufferStereo = True
        # self.traits.screenNum = 1

        gw = osgViewer.GraphicsWindowEmbedded(self.traits)
        self.viewer.getCamera().setViewport(osg.Viewport(0, 0, width, height))
        self.viewer.getCamera().setProjectionMatrixAsPerspective(
            30.0,
            float(width) / float(height), 1.0, 10000.0)
        self.viewer.getCamera().setGraphicsContext(gw)

        return gw
Ejemplo n.º 4
0
 def embedInContext(self):
     """create a osg.GraphicsWindow for a Qt.QWidget window"""
     gw = osgViewer.GraphicsWindowEmbedded(0, 0, self.width(),
                                           self.height())
     return gw