diff options
Diffstat (limited to 'src/render.cpp')
-rw-r--r-- | src/render.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/render.cpp b/src/render.cpp index ceef025..5efccce 100644 --- a/src/render.cpp +++ b/src/render.cpp @@ -69,7 +69,7 @@ void RenderSystem::update([[maybe_unused]] entityx::EntityManager& entities, ); glm::mat4 model = glm::mat4(1.0f); - model = glm::scale(model, glm::vec3(2.0f)); + model = glm::scale(model, glm::vec3(8.0f)); glUseProgram(s); @@ -178,7 +178,28 @@ void RenderSystem::update([[maybe_unused]] entityx::EntityManager& entities, 5*sizeof(float), (void*)(3*sizeof(float))); glDrawArrays(GL_TRIANGLES, 0, 6); }); - + + std::basic_string<WorldMeshData>& wm = worldSystem.current()->getMesh(); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, worldSystem.current()->getTexture()); + glUniform1i(q, 0); + + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D, worldSystem.current()->getNormal()); + glUniform1i(n, 1); + + glBindBuffer(GL_ARRAY_BUFFER, world_vbo); + glBufferData(GL_ARRAY_BUFFER, + wm.size() * sizeof(WorldMeshData), + &wm.front(), + GL_STREAM_DRAW); + + glVertexAttribPointer(a, 3, GL_FLOAT, GL_FALSE, + 6*sizeof(float), 0); + glVertexAttribPointer(t, 2, GL_FLOAT, GL_FALSE, + 6*sizeof(float), (void*)(3*sizeof(float))); + glDrawArrays(GL_TRIANGLES, 0, wm.size()); /************* * CLEANUP * @@ -262,6 +283,7 @@ int RenderSystem::init(void) //glClearColor(0.6, 0.8, 1.0, 0.0); camPos = glm::vec3(0.0f, 0.0f, 0.5f); + glGenBuffers(1, &world_vbo); return 0; } |