Why I can't use uniform1f instead of uniform4f for setting a vec4 uniform?
问题 I learn WebGL step by step via this book. I try to draw three points through using of the buffer ( gl.ARRAY_BUFFER ) instead of cycle (as I did the same earlier in other samples of the book). var u_FragColor = gl.getUniformLocation(gl.program, 'u_FragColor'); if(!u_FragColor){ console.log('Can\'t to get the "u_FragColor" variable.'); return -1; } // gl.uniform1f(u_FragColor, 1.0); // <- this variant doesn't work! Why? gl.uniform4f(u_FragColor, 1.0, 0.0, 0.0, 1.0); It works fine, but I have a