mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 19:58:54 +01:00
opengl: Refactoring: Remove ResetViewportSize
This commit is contained in:
parent
09fe1886d7
commit
6dceeb343c
@ -146,13 +146,6 @@ func (q *commandQueue) Flush() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// glViewport must be called at least at every frame on iOS.
|
|
||||||
// This is introduced at https://github.com/hajimehoshi/ebiten/commit/e9de66aca2007a679de4ba11ea14ef061dca2f6e.
|
|
||||||
// At that time viewport sizes were always same so it was needed to force to call
|
|
||||||
// glViewport, but now viewport sizes can change and apps can work without this. This is
|
|
||||||
// needed only when the screen framebuffer size and the first framebuffer size are same,
|
|
||||||
// probably.
|
|
||||||
opengl.GetContext().ResetViewportSize()
|
|
||||||
es := q.indices
|
es := q.indices
|
||||||
vs := q.vertices
|
vs := q.vertices
|
||||||
if recordLog() {
|
if recordLog() {
|
||||||
|
@ -100,8 +100,16 @@ func (c *Context) SetViewport(f Framebuffer, width, height int) {
|
|||||||
c.bindFramebuffer(f)
|
c.bindFramebuffer(f)
|
||||||
if c.lastViewportWidth != width || c.lastViewportHeight != height {
|
if c.lastViewportWidth != width || c.lastViewportHeight != height {
|
||||||
c.setViewportImpl(width, height)
|
c.setViewportImpl(width, height)
|
||||||
c.lastViewportWidth = width
|
// glViewport must be called at least at every frame on iOS.
|
||||||
c.lastViewportHeight = height
|
// As the screen framebuffer is the last render target, next SetViewport should be
|
||||||
|
// the first call at a frame.
|
||||||
|
if f == c.screenFramebuffer {
|
||||||
|
c.lastViewportWidth = 0
|
||||||
|
c.lastViewportHeight = 0
|
||||||
|
} else {
|
||||||
|
c.lastViewportWidth = width
|
||||||
|
c.lastViewportHeight = height
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,11 +117,6 @@ func (c *Context) ScreenFramebuffer() Framebuffer {
|
|||||||
return c.screenFramebuffer
|
return c.screenFramebuffer
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) ResetViewportSize() {
|
|
||||||
c.lastViewportWidth = 0
|
|
||||||
c.lastViewportHeight = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Context) MaxTextureSize() int {
|
func (c *Context) MaxTextureSize() int {
|
||||||
if c.maxTextureSize == 0 {
|
if c.maxTextureSize == 0 {
|
||||||
c.maxTextureSize = c.maxTextureSizeImpl()
|
c.maxTextureSize = c.maxTextureSizeImpl()
|
||||||
|
Loading…
Reference in New Issue
Block a user