From f3df7ef89aa15aed2e4d68e2b414d31aef57f976 Mon Sep 17 00:00:00 2001 From: neoraider Date: Mon, 18 Apr 2005 15:27:00 +0000 Subject: Verzeichnisstruktur ge?ndert --- render.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 render.c (limited to 'render.c') diff --git a/render.c b/render.c new file mode 100644 index 0000000..7296055 --- /dev/null +++ b/render.c @@ -0,0 +1,46 @@ +#include +#include +#include +#include +#include +#include + +extern PLAYER player; +extern LEVEL level; +extern GLuint sphere; + +void Render() { + GLfloat light_position[] = { 0.0, 0.0, 0.0, 1.0 }; + GLfloat light_emission[] = {1.0, 1.0, 1.0, 1.0}; + GLfloat std_emission[] = {0.0, 0.0, 0.0, 1.0}; + MATRIX rotate = { + player.rotycos, 0.0, -player.rotysin, 0.0, + 0.0, 1.0, 0.0, 0.0, + player.rotysin, 0.0, player.rotycos, 0.0, + 0.0, 0.0, 0.0, 1.0 + }; + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glLoadIdentity(); + + glRotatef(player.rotx, 1.0, 0.0, 0.0); + glMultMatrixf(rotate.f); + + + glTranslatef(-player.pos.x, -player.pos.y, -player.pos.z); + + glLightfv(GL_LIGHT0, GL_POSITION, light_position); + glPushMatrix(); + glDisable(GL_TEXTURE_2D); + glMaterialfv(GL_FRONT, GL_EMISSION, light_emission); + glTranslatef(light_position[0], light_position[1], light_position[2]); + glScalef(0.1, 0.1, 0.1); + glCallList(sphere); + glMaterialfv(GL_FRONT, GL_EMISSION, std_emission); + glEnable(GL_TEXTURE_2D); + glPopMatrix(); + + DrawRoom(&level, player.room); + + glFlush(); +} -- cgit v1.2.3