So with that in mind, can anyone give me a hand understanding the following questions.
1. Right now my simple shader looks like this:
#version 330
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat4 modelMatrix;
layout (location = 0) in vec4 in_Position;
layout (location = 1) in vec4 in_Color;
smooth out vec4 pass_Color;
void main(void)
{
gl_Position = projectionMatrix * viewMatrix * modelMatrix * in_Position;
pass_Color = in_Color;
}
So i set my projection, view and model matrix in my main code and simply multiply them in the shader, is that right? Should i be passing more 'raw' data to the GPU and calculating the matrices there?
2. Right now in order to translate and rotate my models (just a cube right now), I use the model matrix. I start with an identity matrix and then apply each transform to it before passing the matrix to the shader (see above). Is that the right idea or should i be using the model matrix for something else AND applying my transformations via another matrix.
Any pointers on this would be much appreciated, thanks in advance.