mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-30 04:24:28 +01:00
Bug fix: Structs containing js.Object can't be compared (for now)
This commit is contained in:
parent
1b84cd36d1
commit
da14685fb0
@ -67,7 +67,7 @@ func initialize(c *opengl.Context) error {
|
|||||||
var lastProgram opengl.Program
|
var lastProgram opengl.Program
|
||||||
|
|
||||||
func useProgramColorMatrix(c *opengl.Context, projectionMatrix []float32, geo Matrix, color Matrix) opengl.Program {
|
func useProgramColorMatrix(c *opengl.Context, projectionMatrix []float32, geo Matrix, color Matrix) opengl.Program {
|
||||||
if lastProgram != programColorMatrix {
|
if !lastProgram.Equals(programColorMatrix) {
|
||||||
c.UseProgram(programColorMatrix)
|
c.UseProgram(programColorMatrix)
|
||||||
lastProgram = programColorMatrix
|
lastProgram = programColorMatrix
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,14 @@ type Texture int
|
|||||||
type Framebuffer int
|
type Framebuffer int
|
||||||
type Shader int
|
type Shader int
|
||||||
type Program int
|
type Program int
|
||||||
type UniformLocation int
|
|
||||||
type AttribLocation int
|
// TODO: Remove this after the GopherJS bug was fixed (#159)
|
||||||
|
func (p Program) Equals(other Program) bool {
|
||||||
|
return p == other
|
||||||
|
}
|
||||||
|
|
||||||
|
type UniformLocation gl.UniformLocation
|
||||||
|
type AttribLocation gl.AttribLocation
|
||||||
|
|
||||||
type context struct{}
|
type context struct{}
|
||||||
|
|
||||||
|
@ -39,6 +39,11 @@ type Program struct {
|
|||||||
js.Object
|
js.Object
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Remove this after the GopherJS bug was fixed (#159)
|
||||||
|
func (p Program) Equals(other Program) bool {
|
||||||
|
return p.Object == other.Object
|
||||||
|
}
|
||||||
|
|
||||||
type UniformLocation struct {
|
type UniformLocation struct {
|
||||||
js.Object
|
js.Object
|
||||||
}
|
}
|
||||||
@ -141,7 +146,8 @@ var lastFramebuffer Framebuffer
|
|||||||
|
|
||||||
func (c *Context) SetViewport(f Framebuffer, width, height int) error {
|
func (c *Context) SetViewport(f Framebuffer, width, height int) error {
|
||||||
gl := c.gl
|
gl := c.gl
|
||||||
if lastFramebuffer != f {
|
// TODO: Fix this after the GopherJS bug was fixed (#159)
|
||||||
|
if lastFramebuffer.Object != f.Object {
|
||||||
gl.Flush()
|
gl.Flush()
|
||||||
lastFramebuffer = f
|
lastFramebuffer = f
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user