diff --git a/internal/graphicsdriver/opengl/driver.go b/internal/graphicsdriver/opengl/driver.go index 97eb97e75..0052608e0 100644 --- a/internal/graphicsdriver/opengl/driver.go +++ b/internal/graphicsdriver/opengl/driver.go @@ -73,11 +73,8 @@ func (d *Driver) NewScreenFramebufferImage(width, height int) (graphicsdriver.Im driver: d, width: width, height: height, + screen: true, } - // The (default) framebuffer size can't be converted to a power of 2. - // On browsers, c.width and c.height are used as viewport size and - // Edge can't treat a bigger viewport than the drawing area (#71). - i.framebuffer = newScreenFramebuffer(&d.context, width, height) return i, nil } diff --git a/internal/graphicsdriver/opengl/image.go b/internal/graphicsdriver/opengl/image.go index 8a09bbd71..327bd86fc 100644 --- a/internal/graphicsdriver/opengl/image.go +++ b/internal/graphicsdriver/opengl/image.go @@ -24,6 +24,7 @@ type Image struct { framebuffer *framebuffer width int height int + screen bool } func (i *Image) IsInvalidated() bool { @@ -73,6 +74,15 @@ func (i *Image) ensureFramebuffer() error { if i.framebuffer != nil { return nil } + + if i.screen { + // The (default) framebuffer size can't be converted to a power of 2. + // On browsers, c.width and c.height are used as viewport size and + // Edge can't treat a bigger viewport than the drawing area (#71). + i.framebuffer = newScreenFramebuffer(&i.driver.context, i.width, i.height) + return nil + } + w, h := math.NextPowerOf2Int(i.width), math.NextPowerOf2Int(i.height) f, err := newFramebufferFromTexture(&i.driver.context, i.textureNative, w, h) if err != nil {