Hello everyone,
Let me explain, I try to create a simple camera in free fly mode. I now pass my camera in openGL compatibility 3. So I try to remove the deprecated gluLookAt method to use the MVP matrices.
So I made a sample code below to simulate the returns of the matrix view and projection of my camera.
glm::mat4 projection = glm::perspective(glm::radians(0.0f), (float)1280 / (float)720, 0.1f, 100.f);
glm::mat4 view = glm::lookAt(
glm::vec3(-10, 30, 3),
glm::vec3(0, 0, 0),
glm::vec3(0, 1, 0)
);
glm::mat4 model = glm::mat4(1.0f);
glm::mat4 mvp = projection * view * model;
Now the cruel question is how to send the matrices to the GLSL. So I use this kind of code but I miss the programID I can not get in the object sf :: RenderWindow.
GLuint matrixID = glGetUniformLocation(shaderId, "MVP");
GLuint viewMatrixID = glGetUniformLocation(shaderId, "V");
GLuint modelMatrixID = glGetUniformLocation(shaderId, "M");
glUniformMatrix4fv(matrixID, 1, GL_FALSE, &mvp[0][0]);
glUniformMatrix4fv(modelMatrixID, 1, GL_FALSE, &model[0][0]);
glUniformMatrix4fv(viewMatrixID, 1, GL_FALSE, &view[0][0]);
Is there another way to recover this? Or is the method I am trying to do not at all suitable? If so, could you put me back on track?
I thank you in advance for your feedback.