since VERSION is often set to 120 by default, even if a higher version is available (why so, btw?)? I check for highest shader version available on the CPU and prepend the maximum available GLSL version, say,
#define GLSL_VERSION 150
to all shader code I load. I then do something like,
#if (GLSL_VERSION > __VERSION__) // here I set the maximum supported GLSL version #version 150 #endif // GLSL_VERSION #if (__VERSION__ > 120) # define IN in # define OUT out #else # define IN attribute # define OUT varying #endif // __VERSION __
in my shader. I also check for VERSION in my shader code. This way I can support all possible GLSL shader versions in a certain interval in the same shader code.
My question is, does there exist a better way to do the same task, i.e. support an interval of GLSL versions in the same shader code?