Fix Aspect Ratio Calculation
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user