I am trying to convert this C++ gml code to C and am getting the same array but I cannot see anything on the screen, is there something I am doing wrong maybe on the shader?
GML code in C++:
GLuint MatrixID = glGetUniformLocation(programID, "MVP");
...
glm::mat4 MVP = Projection * View * Model;
printf("MVP:\n");
for(int i=0;i<4;i++)
for(int j=0;j<4;j++)
printf("%.2f\n",MVP[i][j]); //prints the same list as in C
...
//durante el loop
glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &MVP[0][0]); //draw a cube
C code:
GLuint MatrixID = glGetUniformLocation(programID, "MVP");
...
t_mat4 MVP; //t_mat4 defined as typedef double t_mat4[16];
mulMatrix(Projection,View,MVP);
mulMatrix(MVP,Model,MVP);
printf("proj*view*model\n");
inrange(i,16)
printf("%.2f\n",MVP[i]); //unidimensional array
...
//durante el loop
glUniformMatrix4dv(MatrixID, 1, GL_FALSE, MVP); //Nothing shows up
vertex shader:
#version 330 core
// Input vertex data, different for all executions of this shader.
layout(location = 0) in vec3 vertexPosition_modelspace;
layout(location = 1) in vec3 vertexColor;
// Output data ; will be interpolated for each fragment.
out vec3 fragmentColor;
// Values that stay constant for the whole mesh.
uniform mat4 MVP;
void main(){
// Output position of the vertex, in clip space : MVP * position
gl_Position = MVP * vec4(vertexPosition_modelspace,1);
// The color of each vertex will be interpolated
// to produce the color of each fragment
fragmentColor = vertexColor;
}