diff options
Diffstat (limited to 'frontend/shared_cpp/OrthographicRenderer.cpp')
| -rw-r--r-- | frontend/shared_cpp/OrthographicRenderer.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/frontend/shared_cpp/OrthographicRenderer.cpp b/frontend/shared_cpp/OrthographicRenderer.cpp index 1d62c04..21c13a1 100644 --- a/frontend/shared_cpp/OrthographicRenderer.cpp +++ b/frontend/shared_cpp/OrthographicRenderer.cpp @@ -53,7 +53,6 @@ void OrthographicRenderer::unload() { void OrthographicShape::load(OrthographicVertex* inVertices, uint32 inNumVertices, OrthographicRenderer* renderer) { - vertices = inVertices; numVertices = inNumVertices; useShader(renderer->shader); @@ -62,7 +61,7 @@ void OrthographicShape::load(OrthographicVertex* inVertices, uint32 inNumVertice glGenBuffers(1, &vbo); glBindBuffer(GL_ARRAY_BUFFER, vbo); - glBufferData(GL_ARRAY_BUFFER, inNumVertices * sizeof(OrthographicVertex), &vertices[0], GL_STATIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, inNumVertices * sizeof(OrthographicVertex), &inVertices[0], GL_STATIC_DRAW); glEnableVertexAttribArray(renderer->attributes.position); glVertexAttribPointer(renderer->attributes.position, 2, GL_FLOAT, GL_FALSE, sizeof(OrthographicVertex), (GLvoid *)0); @@ -74,21 +73,15 @@ void OrthographicShape::load(OrthographicVertex* inVertices, uint32 inNumVertice glBindVertexArray(0); } -void OrthographicShape::render(OrthographicRenderer* renderer) { +void OrthographicShape::render(OrthographicRenderer* renderer, GLenum drawType) { setShaderMat4(renderer->uniforms.model, model); glBindVertexArray(vao); - glDrawArrays(GL_TRIANGLES, 0, numVertices); + glDrawArrays(drawType, 0, numVertices); glBindVertexArray(0); } void OrthographicShape::unload() { glDeleteVertexArrays(1, &vao); glDeleteBuffers(1, &vbo); - - if (vertices != NULL) { - delete vertices; - } - - vertices = NULL; }
\ No newline at end of file |
