hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/src/platform/opengl/opengl_renderer_api.cpp
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2025-08-15 03:18:29 +0200
committerhachem <im@hachem.wtf>2025-08-15 03:18:29 +0200
commita6655eebe2a69ee427264bd43df5747851ed96df (patch)
treefa8c6ef862898a3d8e19250698dca0d9aaf4f9c2 /src/platform/opengl/opengl_renderer_api.cpp
parent3d8d3259e1cf5a7d88e5d1e530cc8c9bf9140734 (diff)
feat: complete first geodesic 3D raytracing
Diffstat (limited to 'src/platform/opengl/opengl_renderer_api.cpp')
-rw-r--r--src/platform/opengl/opengl_renderer_api.cpp23
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);
+ }
};