Shader Coding - Best Practices: Difference between revisions

m
no edit summary
mNo edit summary
Line 20: Line 20:
</syntaxhighlight>
</syntaxhighlight>
}}
}}
{{Note|if4dnf: it's usually bad practice to do any kind of operations on gl_FragColor assignment. At most a vec4() swizzle is ''accepted'', although even that one is treated differently based on the platform (some assign a temporary variable, some don't). Do wahtever you need in a separate vec4 variable and just assign it's value to gl_FragColor at the end.}}


{{Note|If the fragment isn't running, there should be an error message in the log file (I wish they'd still be written to the console). Might be that the texture isn't defined in the supporting framework for instance - the shader assumed that it is available, but you need to declare it in the matching C++ code/effect file first.}}
{{Note|If the fragment isn't running, there should be an error message in the log file (I wish they'd still be written to the console). Might be that the texture isn't defined in the supporting framework for instance - the shader assumed that it is available, but you need to declare it in the matching C++ code/effect file first.}}