diff options
Diffstat (limited to 'src/platform/opengl/opengl_renderer_api.cpp')
| -rw-r--r-- | src/platform/opengl/opengl_renderer_api.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/platform/opengl/opengl_renderer_api.cpp b/src/platform/opengl/opengl_renderer_api.cpp index 628c0af..bfb79ac 100644 --- a/src/platform/opengl/opengl_renderer_api.cpp +++ b/src/platform/opengl/opengl_renderer_api.cpp @@ -83,4 +83,27 @@ namespace Donut glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_INT, nullptr); glBindTexture(GL_TEXTURE_2D, 0); } + + void OpenGLRendererAPI::draw_arrays(uint32_t vertex_count, uint32_t first) + { + glDrawArrays(GL_TRIANGLES, first, vertex_count); + } + + void OpenGLRendererAPI::draw_lines(const Ref<VertexArray>& vertex_array, uint32_t index_count) + { + uint32_t count = index_count ? index_count : vertex_array->get_index_buffer()->get_count(); + glDrawElements(GL_LINES, count, GL_UNSIGNED_INT, nullptr); + } + + void OpenGLRendererAPI::bind_texture(uint32_t texture_id, uint32_t slot) + { + glActiveTexture(GL_TEXTURE0 + slot); + glBindTexture(GL_TEXTURE_2D, texture_id); + } + + void OpenGLRendererAPI::bind_image_texture(uint32_t texture_id, uint32_t slot, bool read_only) + { + glBindImageTexture(slot, texture_id, 0, GL_FALSE, 0, + read_only ? GL_READ_ONLY : GL_WRITE_ONLY, GL_RGBA8); + } }; |
