Hi all,
The last view weeks I’ve been working with WebGL en came across some strange behaviour. I was wondering if anyone noticed the same and maybe help to shed some light?
Depth buffer
If I disable depth testing with g_GL.disable(g_GL.DEPTH_TEST);
writing to the depthbuffer is turned off also. Just like calling g_GL.depthMask(false);
Shader variables
When declaring uniform or varying variables in a shader, you have to reference them in the shader otherwise getting it’s location will fail. It’s like vars not in the code path are removed by a preprocessor.
Normally no big deal, but pretty annoying when debugging. I’m currently misusing gl_FrontFacing to dodge this.
Vertex attributes
Say you loaded 2 shaders, shader-A with 3 vertex attributes and shader-B with 4 vertexattributes.
When I only use shader-A nothing will be rendered. I have to also call vertexAttribPointer at least once for shader-B (or some shader with 4 attributes) in the render loop. It doesn’t have to actually render something. Again, no big deal in most cases. But if I would want to show a progress screen while I give resources a few secs to load, i’m in trouble.
I currently do a stub call to vertexAttribPointer for the shader with the most attributes to circumvent this.
I’ve seen all these on multiple browsers (Firefox, Chrome, Opera, Safari).
Any thoughts?