Resizing an FBO

148 views
Skip to first unread message

Jake Zerrer

unread,
Apr 27, 2012, 5:19:14 PM4/27/12
to kivy-...@googlegroups.com
Hi all-

New Kivy user here. I'm playing with something that requires me to occasionally resize a framebuffer. However, I can't quite figure out how to do it. A little bit of test code here:


Line 36 attempts to resize an already-initialized framebuffer. If I comment out line 36, all runs fine. However, if that line of code remains in place, then all I get is a black screen. I believe that line 17 should theoretically fix this, though of course it doesn't. 

What am I doing wrong?

Thanks!

z

Mathieu Virbel

unread,
May 2, 2012, 7:21:57 AM5/2/12
to kivy-...@googlegroups.com
Hi,

I've seen multiple issues on the code:
- populate_fbo() does'nt remove the previous instruction. You always add new one. Don't forget to clear the previous one with: self.fbo.clear()
- resize_fbo() resize correctly the fbo, but a new texture is generated. Cause of that, the previous texture used in setup_fbo() in the rectangle is not valid anymore. You need to set the texture for the Rectangle instruction again:

    def setup_fbo(...):
       ...
       self.r = Rectangle(..., texture=self.fbo.texture)

    def resize_fbo(...):
        self.fbo.size = ...
        self.r.texture = self.fbo.texture

Regards,

Mathieu
Reply all
Reply to author
Forward
0 new messages