def __init__(self, width, height): super().__init__() buffer_format = QOpenGLFramebufferObjectFormat() buffer_format.setAttachment(QOpenGLFramebufferObject.Depth) self._fbo = QOpenGLFramebufferObject(width, height, buffer_format) self._contents = None
def createFramebufferObject(self, size): format = QOpenGLFramebufferObjectFormat() format.setAttachment(QOpenGLFramebufferObject.CombinedDepthStencil) format.setSamples(4) self._qfbo = QOpenGLFramebufferObject(size, format) return self._qfbo
def get_frame_cv(self, width, height): fmt = QOpenGLFramebufferObjectFormat() fmt.setSamples(self.fmt.samples()) fbo = QOpenGLFramebufferObject(width, height) fbo.setAttachment(fbo.Depth) fbo.bind() GL.glFinish() # resize framebuffer to desired resolution self.resizeGL(width, height) # draw the scene self.update_scene() self.glDraw() GL.glFinish() # read the raw image data img = GL.glReadPixels(0, 0, width, height, GL.GL_RGB, GL.GL_UNSIGNED_BYTE) # convert raw image data to cv2 format img = np.reshape(np.frombuffer(img, np.ubyte), (height, width, 3)) img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR) img = cv2.flip(img, 0) fbo.release() return img
def createFramebufferObject(self, size): #print("\n\nLogoInFboRenderer.createFramebufferObject", size)#, QApplication.instance() format = QOpenGLFramebufferObjectFormat() format.setAttachment(QOpenGLFramebufferObject.CombinedDepthStencil) format.setSamples(4) self.frmBuffer = QOpenGLFramebufferObject(size, format) #print("hola3", self.frmBuffer) return self.frmBuffer
def createFrameBuffer(self, width, height): buffer_format = QOpenGLFramebufferObjectFormat() buffer_format.setAttachment(QOpenGLFramebufferObject.Depth) return QOpenGLFramebufferObject(width, height, buffer_format)
def createFrameBufferObject(self, size): f = QOpenGLFramebufferObjectFormat() f.setAttachment(QOpenGLFramebufferObject.CombinedDepthStencil) f.setSamples(4) return QOpenGLFramebufferObject(size, f)