opengl: Initialize lastTexture

This commit is contained in:
Hajime Hoshi 2016-07-09 23:14:24 +09:00
parent 275fc66f06
commit d8e7ec5274
3 changed files with 15 additions and 3 deletions

View File

@ -37,7 +37,10 @@ type attribLocation int32
type programID uint32
const invalidFramebuffer = (1 << 32) - 1
const (
invalidTexture = 0
invalidFramebuffer = (1 << 32) - 1
)
func (p Program) id() programID {
return programID(p)
@ -106,6 +109,7 @@ func (c *Context) Reset() error {
return nil
}
c.locationCache = newLocationCache()
c.lastTexture = invalidTexture
c.lastFramebuffer = invalidFramebuffer
c.lastViewportWidth = 0
c.lastViewportHeight = 0

View File

@ -52,7 +52,10 @@ type attribLocation int
type programID int
var invalidFramebuffer = Framebuffer{nil}
var (
invalidTexture = Texture{}
invalidFramebuffer = Framebuffer{}
)
func (p Program) id() programID {
return programID(p.Get("__ebiten_programId").Int())
@ -115,6 +118,7 @@ func NewContext() (*Context, error) {
func (c *Context) Reset() error {
c.locationCache = newLocationCache()
c.lastTexture = invalidTexture
c.lastFramebuffer = invalidFramebuffer
c.lastViewportWidth = 0
c.lastViewportHeight = 0

View File

@ -34,7 +34,10 @@ type attribLocation mgl.Attrib
type programID uint32
var invalidFramebuffer = Framebuffer(mgl.Framebuffer{(1 << 32) - 1})
var (
invalidTexture = Texture(mgl.Texture{})
invalidFramebuffer = Framebuffer(mgl.Framebuffer{(1 << 32) - 1})
)
func (p Program) id() programID {
return programID(p.Value)
@ -93,6 +96,7 @@ loop:
func (c *Context) Reset() error {
c.locationCache = newLocationCache()
c.lastTexture = invalidTexture
c.lastFramebuffer = invalidFramebuffer
c.lastViewportWidth = 0
c.lastViewportHeight = 0