Ejemplo n.º 1
0
 def makeTextureBuffer(name, xSize, ySize, tex = None, toRam = False, fbp = None):
   """Copied from graphicsOutput.cxx and pythonified."""
   if fbp == None:
     fbp = FrameBufferProperties()
     fbp.setRgbColor(1)
     fbp.setDepthBits(1)
   
   flags = GraphicsPipe.BFRefuseWindow;
   if hasattr(GraphicsPipe, "BFSizePower2") and Texture.getTexturesPower2() != ATSNone:
     flags |= GraphicsPipe.BFSizePower2
   if tex != None and tex.getTextureType() == Texture.TTCubeMap:
     flags |= GraphicsPipe.BFSizeSquare
   
   buffer = WindowManager.gsg.getEngine().makeOutput(base.pipe, name, 0,
              fbp, WindowProperties.size(xSize, ySize), flags, WindowManager.gsg)
   if WindowManager.gsg == None:
     WindowManager.gsg = buffer.getGsg()
   
   if buffer != None:
     if toRam:
       buffer.addRenderTexture(tex, RTMCopyRam);
     else:
       buffer.addRenderTexture(tex, RTMBindOrCopy);
     return buffer
   
   return None
Ejemplo n.º 2
0
    def createBuffer(self, name, xsize, ysize, texgroup, depthbits=1):
        """ Low-level buffer creation.  Not intended for public use. """

        winprops = WindowProperties()
        winprops.setSize(xsize, ysize)
        props = FrameBufferProperties(self.win.getFbProperties())
        props.setBackBuffers(0)
        props.setRgbColor(1)
        props.setDepthBits(depthbits)
        depthtex, colortex, auxtex0, auxtex1 = texgroup
        if (auxtex0 != None):
            props.setAuxRgba(1)
        if (auxtex1 != None):
            props.setAuxRgba(2)
        buffer=base.graphicsEngine.makeOutput(
            self.win.getPipe(), name, -1,
            props, winprops, GraphicsPipe.BFRefuseWindow | GraphicsPipe.BFResizeable,
            self.win.getGsg(), self.win)
        if (buffer == None):
            return buffer
        if (depthtex):
            buffer.addRenderTexture(depthtex, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPDepth)
        if (colortex):
            buffer.addRenderTexture(colortex, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPColor)
        if (auxtex0):
            buffer.addRenderTexture(auxtex0, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPAuxRgba0)
        if (auxtex1):
            buffer.addRenderTexture(auxtex1, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPAuxRgba1)
        buffer.setSort(self.nextsort)
        buffer.disableClears()
        self.nextsort += 1
        return buffer
def createOffscreenBuffer(sort):
    winprops = WindowProperties.size(SIZE, SIZE)
    props = FrameBufferProperties()
    props.setRgbColor(1)
    props.setAlphaBits(1)
    props.setDepthBits(1)
    return base.graphicsEngine.makeOutput(base.pipe, "offscreenBuffer", sort,
                                          props, winprops,
                                          GraphicsPipe.BFRefuseWindow,
                                          base.win.getGsg(), base.win)
Ejemplo n.º 4
0
    def createBuffer(self, name, xsize, ysize, texgroup, depthbits=1):
        winprops = WindowProperties()
        winprops.setSize(xsize, ysize)
        props = FrameBufferProperties()
        props.setRgbColor(1)
        props.setDepthBits(depthbits)
        (depthtex, colortex, auxtex0, auxtex1) = texgroup
        if auxtex0 != None:
            props.setAuxRgba(1)

        if auxtex1 != None:
            props.setAuxRgba(2)

        buffer = base.graphicsEngine.makeOutput(
            self.win.getPipe(), name, -1, props, winprops,
            GraphicsPipe.BFRefuseWindow | GraphicsPipe.BFResizeable,
            self.win.getGsg(), self.win)
        if buffer == None:
            return buffer

        if depthtex:
            buffer.addRenderTexture(depthtex, GraphicsOutput.RTMBindOrCopy,
                                    GraphicsOutput.RTPDepthStencil)

        if colortex:
            buffer.addRenderTexture(colortex, GraphicsOutput.RTMBindOrCopy,
                                    GraphicsOutput.RTPColor)

        if auxtex0:
            buffer.addRenderTexture(auxtex0, GraphicsOutput.RTMBindOrCopy,
                                    GraphicsOutput.RTPAuxRgba0)

        if auxtex1:
            buffer.addRenderTexture(auxtex1, GraphicsOutput.RTMBindOrCopy,
                                    GraphicsOutput.RTPAuxRgba1)

        buffer.setSort(self.nextsort)
        buffer.disableClears()
        buffer.getDisplayRegion(0).disableClears()
        self.nextsort += 1
        return buffer