Reputation: 41
When writing code for a fragment shader, it starts as follows:
#ifdef GL_ES
precision mediump float;
#endif
Why does the precision mediump float;
line have to depend on whether GL_ES was defined or not?
Upvotes: 4
Views: 640
Reputation: 473192
It doesn't "have to"; it simply does.
Desktop GL will ignore any precision
declarations. So there's no need to ifdef
around it.
That being said, if one wants to share GLSL code with very old versions of desktop GLSL (1.20 or before), then the #ifdef
is useful, as such versions did not allow the precision
declaration.
Upvotes: 5