initializing OpenGL in Video::start()

git-svn-id: svn://anubis/anaglym/trunk@34 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
Josh Holtrop 2009-09-27 21:22:50 +00:00
parent 639af8d59f
commit 218d292388
2 changed files with 13 additions and 0 deletions

View File

@ -1,5 +1,7 @@
#include "Video.h"
#include <GL/gl.h>
#include <GL/glu.h>
#include <SDL.h>
#include <iostream>
using namespace std;
@ -47,6 +49,15 @@ void Video::start(int width, int height, bool fullscreen)
SDL_WM_GrabInput(SDL_GRAB_ON);
m_inputGrabbed = true;
m_fullscreen = fullscreen;
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0, (double) width / (double) height, 0.01, 10000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
}

2
ag.cc
View File

@ -187,7 +187,9 @@ namespace ag
int id = lua_tointeger(L, -1);
Engine::Object * obj = g_engine->getObject(id);
if (obj != NULL)
{
obj->draw();
}
}
lua_pop(L, 1);
}