Creating a framebuffer object deselects the current one

Issue #133 resolved
created an issue


When a framebuffer object is created, it is temporarily selected in order to set the requisite parameters. However, the previously selected framebuffer object is not restored after this is done. As a result, calling will result in subsequent draw calls being performed directly on the backbuffer, not a framebuffer object selected using

In order to return to a known state, the original framebuffer object must be deselected, then reselected after the second one is created.


On lines 65 and 110 of src/modules/graphics/opengl/Framebuffer.cpp, instead of binding the zero FBO, bind the FBO currently selected by the user (or zero, if there is none).




function love.draw(), 0, 0), 255, 0, 255)'fill', 350, 250, 100, 100) fbo1 =, 512) fbo2 =, 512), 0, 0, 255)'fill', 350, 250, 100, 100) love.timer.sleep(1000) end }}}

Expected result: A single green rectangle \ Actual result: Both red and green rectangles

Uncomment the pair of calls to work around the bug.

Comments (3)

  1. Matthias Richter

    Attached an (untested, because I cannot test it atm) patch that hopefully resolves this.

    On a side note: when creating framebuffers in or in every frame (i.e. like you do), the graphics card will soon run out of space for new framebuffers yielding the error in issue #103...

  2. Log in to comment