Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added clear function to FrameBuffer.
Instead of calling window.clear() when we have a framebuffer activated we should call framebuffer.clear().
Then it makes sure to clear the renderbuffers that are set. Of course merging this change will make my other pull request redundant:
#189
  • Loading branch information
sebftw authored Jan 22, 2019
commit 529d04e7e40f579ebca64d487bc5b61feded837d
11 changes: 10 additions & 1 deletion glumpy/gloo/framebuffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

@window.event
def on_draw(dt):
window.clear()
framebuffer.activate()
framebuffer.clear()
quad.draw(gl.GL_TRIANGLE_STRIP)
framebuffer.deactivate()
"""
Expand Down Expand Up @@ -353,6 +353,15 @@ def resize(self, width, height):
self._pending_attachments.append((target, self.stencil))
self._need_attach = True

def clear(self):
""" Clear the framebuffer """

clearflags = gl.GL_COLOR_BUFFER_BIT
if self._depth is not None:
clearflags |= gl.GL_DEPTH_BUFFER_BIT
if self._stencil is not None:
clearflags |= gl.GL_STENCIL_BUFFER_BIT
gl.glClear(clearflags)

def _create(self):
""" Create framebuffer on GPU """
Expand Down