def __init__(self, bufferOptions=set(), **kw): format = QtOpenGL.QGLFormat() format.setRgba(True) format.setAlpha(self.BufferOptions.Alpha in bufferOptions) format.setDepth(self.BufferOptions.Depth in bufferOptions) format.setDoubleBuffer(self.BufferOptions.Double in bufferOptions) self.__multisample = self.BufferOptions.AntiAlias in bufferOptions if self.__multisample: format.setSampleBuffers(True) format.setSamples(8) if hasattr( format, "setVersion"): # setVersion doesn't exist in qt prior to 4.7. format.setVersion(2, 1) graphicsView = _GLGraphicsView(format) self.__graphicsScene = _GLGraphicsScene(graphicsView, Gaffer.WeakMethod(self.__draw)) graphicsView.setScene(self.__graphicsScene) GafferUI.Widget.__init__(self, graphicsView, **kw) self.__overlays = set()
def initialize_scene_view(self): """ Instantiates the proper Scene and enables OpenGL if necessary Scene instantiation must be override in child classes """ if self._use_opengl: self.setViewport(QtOpenGL.QGLWidget(QtOpenGL.QGLFormat(QtOpenGL.QGL.SampleBuffers))) self.log.info('Initializing OpenGL renderer')
def use_OpenGL(self): format = QtOpenGL.QGLFormat(QtOpenGL.QGL.SampleBuffers) format.setSamples(4) self.setViewport(QtOpenGL.QGLWidget(format))