summaryrefslogtreecommitdiff
path: root/engine/background.cpp
blob: 6980cff6d3766b6622aad0123215e1ee4b5410ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "background.h"

#include <wriggle/gl.h>
#include <cmath>

void Background::draw() {
	glClearColor(0.2, 0.2, 0.2, 0);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(45, (float)660 / (float)740, 1, 100);
	
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	
	static float f = 0.0;
	f += 0.01;
	
	gluLookAt(
		5 * sinf(f), 1, 5 * cosf(f),
		0, 0, 0,
		5 * sinf(f), 2, 5 * cosf(f));
	
	glBegin(GL_LINES);
	for(int i = -10; i < 11; i++) {
		if(i % 5 == 0)
			glColor3f(1, 1, 1);
		else
			glColor3f(.5, .5, .5);
		glVertex3f(i, 0, -10);
		glVertex3f(i, 0, 10);
		glVertex3f(-10, 0, i);
		glVertex3f(10, 0, i);
	}
	glEnd();
}