コード例 #1
0
ファイル: model_app.py プロジェクト: daniel-/python-gl-engine
 def setDefaultSceneFBO(self):
     """ set the default fbo for offscreen scene rendering. """
     drawSceneFBO = FBO()
     drawSceneFBO.addColorTexture(self.sceneTexture)
     drawSceneFBO.setDepthTexture(self.sceneDepthTexture)
     drawSceneFBO.create()
     self.appendFBO(drawSceneFBO, self.drawSceneComplete, self.sceneCamera)
コード例 #2
0
    def _setupReflectionPass(self):
        """
        prepends a rendering pass each frame,
        rendering the reflected scene to fbo.
        """
        # get configurable map size
        w, h = self.segment.getAttr("reflectionMapSize", (512, 512))
        self.reflectionColor = Texture2D(width=w, height=h)
        self.reflectionColor.create()
        reflectionDepth = DepthTexture2D(width=w, height=h)
        reflectionDepth.create()

        reflectionFBO = FBO()
        reflectionFBO.addColorTexture(self.reflectionColor)
        reflectionFBO.setDepthTexture(reflectionDepth)
        reflectionFBO.create()

        # draw the reflected scene with same camera as scene
        self.app.prependFBO(reflectionFBO, self._drawReflectedScene, self.app.sceneCamera)