Try: Projection * View * Model
They are all 3 Mat4 Model would be: 1
Then push the stuff back to the shader.
Domanda
I made a shader for my VBO cube (Coloring) and have some problems.
When enabling the shader, I can't move the camera.
My camera breaks with the shader enabled.
Cube.vert:
#version 330 core
layout(location = 0) in vec3 vertexPosition_modelspace;
// Notice that the "1" here equals the "1" in glVertexAttribPointer
layout(location = 1) in vec3 vertexColor;
// Output data ; will be interpolated for each fragment.
out vec3 fragmentColor;
void main()
{
gl_Position.xyz = vertexPosition_modelspace;
gl_Position.w = 1.0;
// The color of each vertex will be interpolated
// to produce the color of each fragment
fragmentColor = vertexColor;
}
Cube.frag:
#version 330 core
// Interpolated values from the vertex shaders
in vec3 fragmentColor;
// Ouput data
out vec3 color;
void main(){
// Output color = color specified in the vertex shader,
// interpolated between all 3 surrounding vertices
color = fragmentColor;
}
Soluzione
Try: Projection * View * Model
They are all 3 Mat4 Model would be: 1
Then push the stuff back to the shader.