mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
Fix BindFramebuffer to pass JS null object explicitly
This commit is contained in:
parent
24c39bcd18
commit
5c755f2f31
@ -32,6 +32,9 @@ type context struct {
|
||||
gl *webgl.Context
|
||||
}
|
||||
|
||||
// TODO: Is there any better way to get null value?
|
||||
var nullVal = js.Global.Call("eval", "null")
|
||||
|
||||
func NewContext(gl *webgl.Context) *Context {
|
||||
c := &Context{
|
||||
Nearest: FilterType(gl.NEAREST),
|
||||
@ -123,7 +126,11 @@ func (c *Context) NewFramebuffer(texture Texture) (Framebuffer, error) {
|
||||
func (c *Context) SetViewport(f Framebuffer, width, height int) error {
|
||||
gl := c.gl
|
||||
gl.Flush()
|
||||
gl.BindFramebuffer(gl.FRAMEBUFFER, f)
|
||||
if f != nil {
|
||||
gl.BindFramebuffer(gl.FRAMEBUFFER, f)
|
||||
} else {
|
||||
gl.BindFramebuffer(gl.FRAMEBUFFER, nullVal)
|
||||
}
|
||||
err := gl.CheckFramebufferStatus(gl.FRAMEBUFFER)
|
||||
if err != gl.FRAMEBUFFER_COMPLETE {
|
||||
if gl.GetError() != 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user