Treating OpenGL function colorMask as passthrough conflicts with WebGL spec
Hi,
I am using the OpenGL function colorMask, which in OpenGL takes GLBoolean (a.k.a. unsigned char), but in WebGL takes a GLboolean, which is a simple boolean (see here ).
Emscripten treats this function as a simple passthrough function, so it does not convert the args from Number to boolean.
While this is not in line with the WebGL specification, it does work in every web browser I tested.
But I want to use node-webgl, which is strictly enforcing the WebGL spec for colorMask (https://github.com/mikeseven/node-webgl/blob/master/lib/webgl.js#L186).
Any ideas to fix this ?
Edit : This is also valid for any other OpenGL function with a GLBoolean argument.
I see. Ok, instead of a simple passthrough we could have a function that makes sure the type is correct, doing e.g. !!x on the boolean params. Pull request would be welcome.
Ok, I'll see what I can do.
However, this is not limited to the passthrough functions. uniformMatrix4fv for instance has a boolean parameter transpose which is passed as-is to the WebGL function.
Created #4703 with a fix
Fixed by your PR.