]> git.lizzy.rs Git - shadowclad.git/blob - glut_janitor.c
Format header includes
[shadowclad.git] / glut_janitor.c
1 #include <GL/gl.h>
2
3 void init_render() {
4         // Set the clear colour to black
5         glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
6 }
7
8 void resize_stage(GLsizei width, GLsizei height) {
9         if (height == 0)
10                 height = 1;
11         
12         // Set device viewport dimensions
13         glViewport(0, 0, width, height);
14         // Switch to projection matrix
15         glMatrixMode(GL_PROJECTION);
16         // Reset the projection matrix
17         glLoadIdentity();
18         
19         GLfloat aspect_ratio = (GLfloat)width / (GLfloat)height;
20         
21         glOrtho(-10.0f, 10.0f, -10.0f/aspect_ratio, 10.0f/aspect_ratio, 128.0, -128.0);
22         
23         glRotatef(45.0f, 1.0f, 0.0f, 0.0f);
24         glRotatef(45.0f, 0.0f, 1.0f, 0.0f);
25         
26         glMatrixMode(GL_MODELVIEW);
27 }