]> git.lizzy.rs Git - shadowclad.git/blob - ui.c
Reorder, move and rename things
[shadowclad.git] / ui.c
1 #include <GL/gl.h>
2
3 void resizeStage(GLsizei width, GLsizei height) {
4         if (height == 0)
5                 height = 1;
6         
7         // Set device viewport dimensions
8         glViewport(0, 0, width, height);
9         // Switch to projection matrix
10         glMatrixMode(GL_PROJECTION);
11         // Reset the projection matrix
12         glLoadIdentity();
13         
14         GLfloat aspectRatio = (GLfloat) width / (GLfloat) height;
15         
16         glOrtho(-8.0, 8.0, -8.0/aspectRatio, 8.0/aspectRatio, 128.0, -128.0);
17         
18         glRotatef(45.0f, 1.0f, 0.0f, 0.0f);
19         glRotatef(45.0f, 0.0f, 1.0f, 0.0f);
20         
21         glMatrixMode(GL_MODELVIEW);
22 }