glBindTexture fails on HTML5 when binding tex 0

Monkey Forums/Monkey Bug Reports/glBindTexture fails on HTML5 when binding tex 0

JaviCervera(Posted 2015) [#1]
As the topic says, Monkey v85e crashes on HTML5 target when doing glBindTexture(GL_TEXTURE_2D, 0) with the gles20 module. It used to work before. The reported error on Firefox is:

Monkey Runtime Error : TypeError: Argument 2 of WebGLRenderingContext.bindTexture is not an object.

It used to work before, and its behaviour is correct on all OpenGL implementations I have tried.


FelipeA(Posted 2015) [#2]
I think it's badly translated.
The compiler is generating this javascript code

gl.bindTexture(GL_TEXTURE_2D, 0);

and it should generate:

gl.bindTexture(GL_TEXTURE_2D, null);


k.o.g.(Posted 2015) [#3]
hmm i don't think its bad compiled, when JaviCervera use glBindTexture(GL_TEXTURE_2D, 0), then the compiler use "0" as integer, have you ever tried glBindTexture(GL_TEXTURE_2D, Null) ?
When it's not possible, so mark must add a new definition of function in gles20 module.


marksibly(Posted 2015) [#4]
Can you try replacing function _glBindTexture in modules/opengl/native/gles20.html5.js with this:

function _glBindTexture( target,tex ){
	if( tex ){
		gl.bindTexture( target,tex );
	}else{
		gl.bindTexture( target,null );
	}
}


Should be on line 39.