Skip to content

Commit

Permalink
WebGL unbind Texture
Browse files Browse the repository at this point in the history
  • Loading branch information
nkast committed May 29, 2022
1 parent 4c2a5ea commit 2926cd2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Wasm.Canvas/Canvas/WebGL/WebGLRenderingContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ public void PixelStore(WebGLPixelParameter pname, int param)

public void BindTexture(WebGLTextureTarget target, WebGLTexture texture)
{
Invoke("nkCanvasGLContext.BindTexture", (int)target, texture.Uid);
int uid = (texture != null) ? texture.Uid : -1;
Invoke("nkCanvasGLContext.BindTexture", (int)target, uid);
}

public void BindBuffer(WebGLBufferType type, WebGLBuffer buffer)
Expand Down
2 changes: 1 addition & 1 deletion Wasm.Canvas/wwwroot/js/CanvasGLContext.6.0.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ window.nkCanvasGLContext =
var gc = nkJSObject.GetObject(uid);
var tg = Blazor.platform.readInt32Field(d, 0);
var txuid = Blazor.platform.readInt32Field(d, 4);
var tx = nkJSObject.GetObject(txuid);
var tx = (txuid != -1) ? nkJSObject.GetObject(txuid) : null;
gc.bindTexture(tg, tx);
},

Expand Down

0 comments on commit 2926cd2

Please sign in to comment.