The title is my question. Is there any replacement of 'binding' layout qualifier for OpenGL v 4.1?
I'm using MacOS and Xcode so if I run OpenGL 4.2 I got an error of glewinit saying 'Missing GL version'.
If I run this code with OpenGL 4.1, of course, it can't recognize 'binding' keyword.
My vertex shader code is :
#version 410
layout (location=0) in vec3 pos;
layout (location=1) in vec2 texCoord;
out vec2 tc;
uniform mat4 mv_matrix;
uniform mat4 proj_matrix;
layout (binding=0) uniform sampler2D samp; // not used in vertex shader
void main(void) {
gl_Position = proj_matrix * mv_matrix * vec4(pos, 1.0);
tc = texCoord;
}
and my fragment shader code is :
#version 410
in vec2 tc; // interpolated incoming texture coordinate
out vec4 color;
uniform mat4 mv_matrix;
uniform mat4 proj_matrix;
layout (binding=0) uniform sampler2D samp;
void main(void) {
color = texture(samp, tc);
}
binding=0
) you don't need it at all, because 0 is default. – Rabbid76