mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-27 11:12:44 +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
|
||||
|
||||
func useProgramColorMatrix(c *opengl.Context, projectionMatrix []float32, geo Matrix, color Matrix) opengl.Program {
|
||||
if lastProgram != programColorMatrix {
|
||||
if !lastProgram.Equals(programColorMatrix) {
|
||||
c.UseProgram(programColorMatrix)
|
||||
lastProgram = programColorMatrix
|
||||
}
|
||||
|
@ -26,8 +26,14 @@ type Texture int
|
||||
type Framebuffer int
|
||||
type Shader 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{}
|
||||
|
||||
|
@ -39,6 +39,11 @@ type Program struct {
|
||||
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 {
|
||||
js.Object
|
||||
}
|
||||
@ -141,7 +146,8 @@ var lastFramebuffer Framebuffer
|
||||
|
||||
func (c *Context) SetViewport(f Framebuffer, width, height int) error {
|
||||
gl := c.gl
|
||||
if lastFramebuffer != f {
|
||||
// TODO: Fix this after the GopherJS bug was fixed (#159)
|
||||
if lastFramebuffer.Object != f.Object {
|
||||
gl.Flush()
|
||||
lastFramebuffer = f
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user