From dee50239be8fff566b3ca687bc70900b391a8164 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Wed, 16 Aug 2017 20:11:07 +0500 Subject: 2017-08-16 --- src/RendererSection.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/RendererSection.cpp') diff --git a/src/RendererSection.cpp b/src/RendererSection.cpp index 439fab1..a2d6825 100644 --- a/src/RendererSection.cpp +++ b/src/RendererSection.cpp @@ -123,7 +123,7 @@ RendererSection::~RendererSection() { refCounterVbo[VboModels]--; refCounterVbo[VboColors]--; refCounterVao[Vao]--; - if (refCounterVbo[VboTextures] <= 0) + /*if (refCounterVbo[VboTextures] <= 0) glDeleteBuffers(1, &VboTextures); if (refCounterVbo[VboModels] <= 0) @@ -132,12 +132,13 @@ RendererSection::~RendererSection() { glDeleteBuffers(1, &VboColors); if (refCounterVao[Vao] <= 0) - glDeleteVertexArrays(1, &Vao); + glDeleteVertexArrays(1, &Vao);*/ } void RendererSection::Render(RenderState &renderState) { if (!isEnabled) return; if (!models.empty()) { + LOG(INFO) << "Rendering unready section"; PrepareRender(); } renderState.SetActiveVao(Vao); @@ -332,15 +333,15 @@ void RendererSection::PrepareResources() { void RendererSection::PrepareRender() { glBindBuffer(GL_ARRAY_BUFFER, VboTextures); glBufferData(GL_ARRAY_BUFFER, textures.size() * sizeof(glm::vec4), textures.data(), GL_DYNAMIC_DRAW); - textures.clear(); + std::vector().swap(textures); glBindBuffer(GL_ARRAY_BUFFER, VboModels); glBufferData(GL_ARRAY_BUFFER, models.size() * sizeof(glm::mat4), models.data(), GL_DYNAMIC_DRAW); - models.clear(); + std::vector().swap(models); glBindBuffer(GL_ARRAY_BUFFER, VboColors); glBufferData(GL_ARRAY_BUFFER, colors.size() * sizeof(glm::vec3), colors.data(), GL_DYNAMIC_DRAW); - colors.clear(); + std::vector().swap(colors); glBindBuffer(GL_ARRAY_BUFFER, 0); } -- cgit v1.2.3