I am trying to pass the vertex positions as a simple out vec3 pos
from the vertex shader to the fragment shader in order to color vertices based on their position. Here is my vertex shader code:
#version 330 core
in vec3 position;
out vec3 pos;
uniform mat4 u_model;
void main(){
pos = position;
gl_Position = u_model * vec4(position, 1.0f);
}
Fragment shader:
#version 330 core
out vec4 color;
in vec4 pos;
void main(){
color = vec4(pos.x, 0.0f, 0.0f, 1.0f);
}
Now this only works when I run the program with the Nsight Graphics Debugger in Visual Studio 2019.
When I execute normally (x64, Debug) it seems to fall back to a default shader, which renders everything white. The vertex and fragment shader posted above stop working.