summaryrefslogtreecommitdiff
path: root/engine/background.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engine/background.cpp')
-rw-r--r--engine/background.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/engine/background.cpp b/engine/background.cpp
new file mode 100644
index 0000000..076c6cf
--- /dev/null
+++ b/engine/background.cpp
@@ -0,0 +1,37 @@
+#include "background.h"
+
+#include <SDL/SDL_opengl.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();
+}