WebGL: Difference between revisions

273 bytes added ,  12 October 2019
 
Line 11: Line 11:


===Pass floats as textures===
===Pass floats as textures===
[https://developer.mozilla.org/en-US/docs/Web/API/OES_texture_float Reference]<br>
[https://stackoverflow.com/questions/39136068/how-to-use-the-oes-texture-float-extension-and-create-a-texture-as-a-floating-p/39149111#39149111 Example]<br>
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>
If you're using WebGL 2, you can use [https://www.khronos.org/registry/webgl/specs/latest/2.0-compute/ compute shaders].
If you're using WebGL 2, you can use [https://www.khronos.org/registry/webgl/specs/latest/2.0-compute/ compute shaders].
Note this is built into WebGL 2.


===Fetching Texels===
===Fetching Texels===