From 63e3b825580c8fbf6b84d441c92ed39348e51c17 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Wed, 11 May 2011 19:30:31 +0200 Subject: Working win32 port. --- scene.cpp | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'scene.cpp') diff --git a/scene.cpp b/scene.cpp index cc7db04..e371f74 100644 --- a/scene.cpp +++ b/scene.cpp @@ -35,10 +35,9 @@ Scene::Scene() { terrain_program.link(); terrain_program.use(); - GLint tex1loc = glGetUniformLocation(terrain_program.get_program(), "tex[1]"); - glUniform1i(tex1loc, 1); - GLint tex2loc = glGetUniformLocation(terrain_program.get_program(), "tex[2]"); - glUniform1i(tex2loc, 2); + GLint tex = glGetUniformLocation(terrain_program.get_program(), "tex"); + GLint texv[] = {0, 1, 2}; + glUniform1iv(tex, 3, texv); GLint markloc = glGetUniformLocation(terrain_program.get_program(), "marktex"); glUniform1i(markloc, 3); glUseProgram(0); @@ -53,8 +52,8 @@ Scene::Scene() { terrain = new Terrain(); /* load font */ - //font = new FTTextureFont("fonts/VeraMono.ttf"); - //font->FaceSize(10); + font = new FTTextureFont("fonts/VeraMono.ttf"); + font->FaceSize(10); GUI::init(); } @@ -64,7 +63,7 @@ Scene::~Scene() { delete tool; if(terrain) delete terrain; - //delete font; + delete font; } void Scene::lookat() { @@ -395,14 +394,8 @@ void Scene::render() { Terrain::Chunk *chunk = *it; glPushMatrix(); glTranslatef(-pos.x, -pos.y, -pos.z); - /*if(!chunk->nodes) { - for(int i = 0; i < 4; i++) - q.push(chunk->children[i]); - continue; - } else*/ if(chunk->vbo_object) { - for(unsigned int i = 0; i < chunk->node_count; i++) - chunk->nodes[i]->draw_grid(); - } + for(unsigned int i = 0; i < chunk->node_count; i++) + chunk->nodes[i]->draw_grid(); glPopMatrix(); } } @@ -448,7 +441,7 @@ void Scene::render() { glPopMatrix(); video::ortho(); - /*float height = font->LineHeight(); + float height = font->LineHeight(); glColor3f(1, 1, 1); glTranslatef(0, video::height-height, 0); font->Render((boost::format("chunks: %d gravity: %d steps: %d") @@ -464,7 +457,7 @@ void Scene::render() { if(tool) { glTranslatef(0, -height, 0); font->Render((boost::format("Tool: %s") % tool->get_name()).str().c_str()); - }*/ + } /*if(selected) { glTranslatef(0, height, 0); //font->Render((boost::format("(%s %s %s %s)") % selected->a->str() % selected->b->str() % selected->c->str() % selected->d->str()).str().c_str()); -- cgit v1.2.3