mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-24 18:02:02 +01:00
graphicsdriver/opengl: Refactoring
This commit is contained in:
parent
7586c660d5
commit
44d1b137e7
@ -86,7 +86,11 @@ func (c *context) bindFramebuffer(f framebufferNative) {
|
||||
func (c *context) setViewport(f *framebuffer) {
|
||||
c.bindFramebuffer(f.native)
|
||||
if c.lastViewportWidth != f.width || c.lastViewportHeight != f.height {
|
||||
// On some environments, viewport size must be within the framebuffer size.
|
||||
// e.g. Edge (#71), Chrome on GPD Pocket (#420), macOS Mojave (#691).
|
||||
// Use the same size of the framebuffer here.
|
||||
c.setViewportImpl(f.width, f.height)
|
||||
|
||||
// glViewport must be called at least at every frame on iOS.
|
||||
// As the screen framebuffer is the last render target, next SetViewport should be
|
||||
// the first call at a frame.
|
||||
|
@ -73,8 +73,8 @@ func (i *Image) ensureFramebuffer() error {
|
||||
if i.framebuffer != nil {
|
||||
return nil
|
||||
}
|
||||
w, h := i.width, i.height
|
||||
f, err := newFramebufferFromTexture(&i.driver.context, i.textureNative, math.NextPowerOf2Int(w), math.NextPowerOf2Int(h))
|
||||
w, h := math.NextPowerOf2Int(i.width), math.NextPowerOf2Int(i.height)
|
||||
f, err := newFramebufferFromTexture(&i.driver.context, i.textureNative, w, h)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -264,9 +264,6 @@ func (d *Driver) useProgram(mode graphics.CompositeMode, colorM *affine.ColorM,
|
||||
panic("source image is not set")
|
||||
}
|
||||
|
||||
// On some environments, viewport size must be within the framebuffer size.
|
||||
// e.g. Edge (#71), Chrome on GPD Pocket (#420), macOS Mojave (#691).
|
||||
// Use the same size of the framebuffer here.
|
||||
if err := destination.setViewport(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user