Closed htmlboss closed 7 years ago
The matrix "view_from_clip" in HandleReshapeEvent must be the inverse of a perspective matrix such as GL_PROJECTION. Likewise, the matrix "model_from_view" in HandleRedisplayEvent must be the inverse of a classical GL_MODELVIEW matrix.
Hey!
I'm working on integrating your demo into my engine at the moment and I have a couple of issues:
How would I replace the calculations performed in
Demo::HandleReshapeEvent(int viewport_width, int viewport_height)
with a call toglm::projection()
? I tried to do a simple replacement however the scene ends up being squished in the vertical (+y) direction:const auto mat = glm::perspective(glm::radians(45.0f), 1280.0f / 720.0f, 1.0f, 1000.0f); glUniformMatrix4fv(glGetUniformLocation(program_, "view_from_clip"), 1, false, value_ptr(mat));
Also, in the
void Demo::HandleRedisplayEvent() const
function, where you calculate the"model_from_view"
, and"camera"
uniforms, is the former simply a call toglm::lookat()
, and the latter just the camera position (I have a Camera class that handles movement, orientation, etc., so I just want to keep things centralized instead of having to convert back and forth every frame)?Thanks so much in advance!