Version

Quick search

Table Of Contents

GL instructions

New in version 1.3.0.

Clearing an FBO

To clear an FBO, you can use ClearColor and ClearBuffers instructions like this example:

self.fbo = Fbo(size=self.size)
with self.fbo:
    ClearColor(0, 0, 0, 0)
    ClearBuffers()
class kivy.graphics.gl_instructions.ClearColor(r, g, b, a, **kwargs)

Bases: kivy.graphics.instructions.Instruction

New in version 1.3.0.

Sets the clear color used to clear buffers with the glClear function or ClearBuffers graphics instructions.

a

Alpha component, between 0 and 1.

b

Blue component, between 0 and 1.

g

Green component, between 0 and 1.

r

Red component, between 0 and 1.

rgb

RGB color, a list of 3 values in 0-1 range where alpha will be 1.

rgba

RGBA color used for the clear color, a list of 4 values in the 0-1 range.

class kivy.graphics.gl_instructions.ClearBuffers(*args, **kwargs)

Bases: kivy.graphics.instructions.Instruction

New in version 1.3.0.

Clear the buffers specified by the instructions buffer mask property. By default, only the coloc buffer is cleared.

clear_color

If True, the color buffer will be cleared.

clear_depth

If True, the depth buffer will be cleared.

clear_stencil

If True, the stencil buffer will be cleared.