Reputation: 3429
When there is no version specified in the first line of a GLSL shader (so nothing like "#version 330", which version is actually used?
Is it vendor (or even driver) specific?
Upvotes: 2
Views: 1610
Reputation: 26245
What is the default GLSL version?
#version
directive always must be on the first lineThe
#version
directive must appear before anything else in a shader, save for whitespace and comments. If a#version
directive does not appear at the top, then it assumes 1.10, which is almost certainly not what you want.
If it's in relation to combining sources, then you could leave out the #version
directive and do something like this:
const GLsizei stringCount = 2;
const GLchar *strings[stringCount] = {
"#version 330 core\n",
shaderSource,
};
glShaderSource(shader, stringCount, strings, NULL);
Upvotes: 6