Fix Aspect Ratio Calculation

This commit is contained in:
2024-01-25 19:34:34 -05:00
parent 874f444f50
commit 2e367e2576

View File

@@ -22,7 +22,10 @@ void Engine::initGL()
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//glOrtho(-1.0f, 1.0f, -1.0f, 1.0f, -0.5f, 0.5f);
gluPerspective(this->fov, window->getSize()[0] / window->getSize()[1], this->nearPlane, this->farPlane);
auto window_size = window->getSize();
auto width_over_height = (float) window_size[0] / (float) window_size[1];
auto aspect = width_over_height;
gluPerspective(this->fov, aspect, this->nearPlane, this->farPlane);
this->glError = glGetError();
if (glError != GL_NO_ERROR) {