Login  Register

Re: Whats the correct way to handle OpenGL Extensions in Shader Source

Posted by Pete on Mar 18, 2016; 12:20pm
URL: https://forum.jogamp.org/Whats-the-correct-way-to-handle-OpenGL-Extensions-in-Shader-Source-tp4036517p4036520.html

I've confirmed its not happy because the precision specifiers are defined ahead of the extension define, all defines need to precede anything else. GLSL version would be fine as with your example because it is also a define statement, but notice in your example the precision specifiers are after the #define statements, here mine are being added to the head of the file when using ShaderCode.defaultShaderCustomization(..).

For now I'm working around it so I can press on but it'd be nice to know if there is a convention I can follow. All my other shaders don't have any defines or precision modifiers defined in them to make them generic & cross platform / device - I add GLSL version &/or shader precision at runtime based on what device / OS I'm running on when I load the shader in.

The introduction of an extension define has somewhat derailed this method - unless there is an API methodology to help me out here?

p.s. As to your p.s. I'd be happy to contribute anything of worth I can - it'd be nice to give something back :)