diff options
Diffstat (limited to 'scene.cpp')
-rw-r--r-- | scene.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
@@ -7,6 +7,7 @@ #include "gl.h" +#include <unistd.h> #include <cmath> #include <queue> @@ -34,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); @@ -394,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(); } } |