My question is kinda simple but i cant find it in the web. Does OpenGL / OpenGL ES have preshaders like DirectX?
so that you can write things like
mat4 wvpMat = worldMat * viewMat * projMat;
gl_Position = wvpMat * position;
and it will compute the wvpMat only once in the preshader. Or is this not supported and you should make it on the CPU instead?
see Riemers example for XNA:

OpenGL defines several shader stages:
vertex shader: runs first for all points you wish to draw
optional tesselation with 2 shaders: a control shader to specify how to tesselate and a evaluation shader to do the actual tesselation
optional geometry shader: emit a variable amount of primitive per drawn primitive
fragment shader: runs per fragment
The driver is allowed to optimize each of these as needed when linking the program together, which may include generating a preshader. However, it is implementation-defined.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With