Browse Source

fixed ratio and resize

develop
Robin Thoni 7 years ago
parent
commit
795803376b
1 changed files with 8 additions and 4 deletions
  1. 8
    4
      TheGame/openglrenderdevice.cpp

+ 8
- 4
TheGame/openglrenderdevice.cpp View File

113
 //    glEnable(GL_CULL_FACE);
113
 //    glEnable(GL_CULL_FACE);
114
 
114
 
115
     glMatrixMode(GL_PROJECTION);
115
     glMatrixMode(GL_PROJECTION);
116
-    gluPerspective(_fov, _width / _height, 0.1, 100.0);
116
+    gluPerspective(_fov, (double)_width / _height, 0.1, 100.0);
117
     glMatrixMode(GL_MODELVIEW);
117
     glMatrixMode(GL_MODELVIEW);
118
 }
118
 }
119
 
119
 
121
 {
121
 {
122
     _width = width;
122
     _width = width;
123
     _height = height;
123
     _height = height;
124
-//    glViewport(0, 0, _width, _height);
125
-    int side = qMin(_width, _height);
126
-    glViewport((_width - side) / 2, (_height - side) / 2, side, side);
124
+    glViewport(0, 0, _width, _height);
125
+
126
+    glMatrixMode(GL_PROJECTION);
127
+    glLoadIdentity();
128
+    gluPerspective(_fov, (double)_width / _height, 0.1, 100.0);
129
+    glMatrixMode(GL_MODELVIEW);
130
+    glLoadIdentity();
127
 }
131
 }
128
 
132
 
129
 void OpenGLRenderDevice::preDraw()
133
 void OpenGLRenderDevice::preDraw()

Loading…
Cancel
Save