next problem. Firefox 4.0 Beta 2 (Laptop Intel IGP and PC GTX 260)
I often took a value from a texture in the shader. I calculated something with it, all is fine. I switched the Shader validator on and fixed all signaled errors.
But now I get black Output. For example.
vec4(texture2D(TexSampler,texcoord).xyz,1.0) This make a nice colorfull Output. But I want only 30%
vec4(texture2D(TexSampler,texcoord).xyz * vec(0.3) ,1.0)
produced both a black object. (Shader validator off = 30% output like i want)
vec4(texture2D(TexSampler,texcoord).xyz,1.0)*3.0/10.0 produced the 30% output now. But this is not efficient. I found no hint in the updated WebGL Spec what is wrong with *0.3 ?
Or is it the wrong forum? Should I talk to vladimir directly? (how?)
Firefox 4.0 Beta 3 same problem. validator on = calculations with numbers < 1.0 = 0.0
Did somebody tried ? Or is all correct?
Using the build in function MIX to mix the texturcolor and black like 0.3 to 0.7 failed too.
It is full black. I changed it to 0.7 (texturcolor) so there is a 100% texturcolor.
The issue is most likely you’re using non power of 2 textures and you have filtering on that requires mips. This is not allowed in OpenGL ES 2.0 and WebGL is supposed to be spec compliant with OpenGL ES 2.0.
Firefox was not enforcing that requirement until 4.0b2. Now it is so if you are using an NPOT texture and you don’t turn off mips you’ll get black.
You can either do
gl.texParameteri(gl.TEXTURE_2D, gl.GL_TEXTURE_MIN_FILTER, gl.LINEAR); // or gl.NEAREST
or you can make your texture a power of 2 texture. For example 256x128
And the textur load function had to be the correct. I used a old Style one. I could not suggest that the SHADER validator needed the new version. There was a change. This was important too