Preserve the actively bound framebuffer after using gpu.offscreen

Otherwise we cannot draw anything after drawing in the offscreen buffer
This commit is contained in:
Dalai Felinto 2018-09-20 21:41:30 +00:00
parent 5e2c032f1a
commit fb88088203
1 changed files with 3 additions and 0 deletions

View File

@ -227,6 +227,8 @@ static PyObject *bpygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *a
rv3d_mats = ED_view3d_mats_rv3d_backup(ar->regiondata);
GPUFrameBuffer *active = GPU_framebuffer_active_get();
GPU_offscreen_bind(self->ofs, true); /* bind */
ED_view3d_draw_offscreen(depsgraph,
@ -246,6 +248,7 @@ static PyObject *bpygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *a
NULL);
GPU_offscreen_unbind(self->ofs, true); /* unbind */
GPU_framebuffer_bind(active);
ED_view3d_mats_rv3d_restore(ar->regiondata, rv3d_mats);
MEM_freeN(rv3d_mats);