Jump to content

WebGL: Difference between revisions

7 bytes removed ,  12 October 2019
No edit summary
Line 10: Line 10:
On Javascript, if you are using <code>gl.uniform4fv</code> and want a array of size <code>k</code> in your shader, you will need to pass an array of size 4 * k to the uniform function.
On Javascript, if you are using <code>gl.uniform4fv</code> and want a array of size <code>k</code> in your shader, you will need to pass an array of size 4 * k to the uniform function.


===How to pass floats as textures===
===Pass floats as textures===
Oftentimes, you'll want to pass large arrays into your shader.<br>
Oftentimes, you'll want to pass large arrays into your shader.<br>
If you use uniform arrays such as <code>gl.uniform1fv</code>, you'll be limited to 1024 uniforms [https://stackoverflow.com/questions/50032570/passing-large-array-into-uniform-in-webgl].<br>
If you use uniform arrays such as <code>gl.uniform1fv</code>, you'll be limited to 1024 uniforms [https://stackoverflow.com/questions/50032570/passing-large-array-into-uniform-in-webgl].<br>