From d39f9223d42e47694708507e46581ffc8ddabf87 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Sat, 29 Jan 2011 12:04:59 +0100 Subject: [PATCH] Fbo bind/release documentation --- kivy/graphics/fbo.pyx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/kivy/graphics/fbo.pyx b/kivy/graphics/fbo.pyx index 144320b80..701c8a6dd 100644 --- a/kivy/graphics/fbo.pyx +++ b/kivy/graphics/fbo.pyx @@ -184,6 +184,23 @@ cdef class Fbo(RenderContext): self.set_state('projection_mat', projection_mat) cpdef bind(self): + '''Bind the FBO to the current opengl context. + `Bind` mean that you enable the Framebuffer, and all the drawing + operations will act inside the Framebuffer, until :func:`release` is + called. + + The bind/release operation are automatically done when you add graphics + object in it. But if you want to manipulate a Framebuffer yourself, you + can use it like this: :: + + self.fbo = FBO() + self.fbo.bind() + # do any drawing command + self.fbo.unbind() + + # then, your fbo texture is available at + print self.fbo.texture + ''' if self._is_bound: raise FboException('FBO is already binded.') else: @@ -199,6 +216,8 @@ cdef class Fbo(RenderContext): glViewport(0, 0, self._width, self._height) cpdef release(self): + '''Release the Framebuffer (unbind). + ''' if self._is_bound == 0: raise FboException('Cannot release a FBO not binded.') else: