Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. void GameManager::reshape(GLsizei w, GLsizei h){
  2. float xmin = -4., xmax = 4., ymin = -6., ymax = 6.;
  3. float ratio = (xmax - xmin) / (ymax - ymin);
  4. float aspect = (float)w / h;
  5. if (aspect > ratio)
  6. glViewport((w - h*ratio) / 2, 0, h*ratio, h);
  7. else
  8. glViewport(0, (h - w / ratio) / 2, w, w / ratio);
  9. glMatrixMode(GL_PROJECTION);
  10. glLoadIdentity();
  11. glMatrixMode(GL_MODELVIEW);
  12. glLoadIdentity();
  13. gluOrtho2D(xmin, xmax, ymin, ymax);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement