diff --git a/src/python/magnum/gl.cpp b/src/python/magnum/gl.cpp index f38eeb3..1e17800 100644 --- a/src/python/magnum/gl.cpp +++ b/src/python/magnum/gl.cpp @@ -911,7 +911,13 @@ void gl(py::module_& m) { before the framebuffer */ pyObjectHolderFor(self).attachments.emplace_back(pyObjectFromInstance(renderbuffer)); }, "Attach renderbuffer to given buffer") + .def("attach_texture", [](GL::Framebuffer& self, GL::Framebuffer::BufferAttachment attachment, GL::Texture2D& texture, Int level) { + self.attachTexture(attachment, texture, level); + /* Keep a reference to the texture to avoid it being deleted + before the framebuffer */ + pyObjectHolderFor(self).attachments.emplace_back(pyObjectFromInstance(texture)); + }, "Attach texture to given buffer") .def_property_readonly("attachments", [](GL::Framebuffer& self) { return pyObjectHolderFor(self).attachments; }, "Renderbuffer and texture objects referenced by the framebuffer");