How Many Uniforms Can We Use?

The OpenGL Shading Language ES specification delineates the number of uniforms that we are allowed to use.

Section 4.3.4 Uniforms

There is an implementation dependent limit on the amount of storage for uniforms that can be used for each type of shader. If this is exceeded, it will cause a compile-time or link-time error.

To find out the limit for your WebGL implementation, you can query WebGL using the gl.getParameter function with these constants:

gl.MAX_VERTEX_UNIFORM_VECTORS
gl.MAX_FRAGMENT_UNIFORM_VECTORS

The implementation limit is given by your browser and heavily depends on your graphics hardware. That said, even though your machine may have enough variable space, it does not necessarily mean that the problem is solved. We still have to define and map each of the uniforms and that can often lead to brittle and verbose code, as we will see in a later exercise.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.33.41