From be04dfae83dce6eeef64aa045d58e77afc23634b Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Thu, 4 Mar 2021 13:52:36 +0100 Subject: [PATCH] app/headless: bind output framebuffer at render, not creation Bind the framebuffer as late as possible to lessen the risk of confusing global state (current framebuffer). Commit 25a19481e3f58b774cba9eebb3b2aff42c8cf547 removed the assumption that the framebuffer current at gpu.New would always be the output framebuffer Signed-off-by: Elias Naur --- app/headless/headless.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/headless/headless.go b/app/headless/headless.go index a8abeb6f..a86f27ad 100644 --- a/app/headless/headless.go +++ b/app/headless/headless.go @@ -62,7 +62,6 @@ func NewWindow(width, height int) (*Window, error) { fboTex.Release() return err } - dev.BindFramebuffer(fbo) gp, err := gpu.New(dev) if err != nil { fbo.Release() @@ -109,6 +108,7 @@ func (w *Window) Release() { // operation list. func (w *Window) Frame(frame *op.Ops) error { return contextDo(w.ctx, func() error { + w.backend.BindFramebuffer(w.fbo) w.gpu.Clear(color.NRGBA{A: 0xff, R: 0xff, G: 0xff, B: 0xff}) w.gpu.Collect(w.size, frame) return w.gpu.Frame()