Advertisement
Guest User

Untitled

a guest
Jul 27th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.22 KB | None | 0 0
  1. diff --git a/src/main.cpp b/src/main.cpp
  2. index 91bb311..1cf469a 100644
  3. --- a/src/main.cpp
  4. +++ b/src/main.cpp
  5. @@ -30,7 +30,7 @@ class TextRenderer
  6.     pgl::Program &program;
  7.     pgl::Program &backgroundProgram;
  8.     pgl::vao vao, backgroundVao;
  9. -   pgl::data::vbo vbo;
  10. +   pgl::storage::vbo vbo;
  11.     pgl::data::vbo backgroundVbo;
  12.     pgl::data::ebo ebo, backgroundEbo;
  13.     pgl::Texture &texture;
  14. @@ -168,7 +168,7 @@ public:
  15.                     box.push_back(glm::vec4(vec.x + letterSpacing*i, vec.y, 0, 0));
  16.                 }
  17.             }
  18. -           vbo.bufferData(box, GL_STREAM_DRAW);
  19. +           vbo.bufferData(box, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
  20.             ebo.bind();
  21.             std::vector<GLuint> boxIndices {};
  22.             for(size_t i = 0; i < text.size(); ++i)
  23. @@ -180,7 +180,7 @@ public:
  24.             }
  25.             ebo.bufferData(boxIndices, usage);
  26.         }
  27. -       glm::vec4* box = reinterpret_cast<glm::vec4*>(vbo.mapBuffer(GL_WRITE_ONLY));
  28. +       glm::vec4* box = reinterpret_cast<glm::vec4*>(vbo.getMappedPtr());
  29.         for(size_t i = 0; i < text.size(); ++i)
  30.         {
  31.             char letterX = (this->text[i] - ' ') % 10;
  32. @@ -198,7 +198,6 @@ public:
  33.             box[(i*4)+3].z = letterX*charPosX;
  34.             box[(i*4)+3].w = (letterY*charPosY)+charHeight;
  35.         }
  36. -       vbo.unmapBuffer();
  37.         updateModel();
  38.     }
  39.  };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement