diff options
| author | hachem <im@hachem.wtf> | 2026-08-23 17:41:31 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-08-23 17:41:31 +0200 |
| commit | 8742482311b86bb705d93336805ab26881e96070 (patch) | |
| tree | f2cb9d19864cf3f5b3a571326c9ad834c25dd5e2 /src/platform/opengl | |
| parent | 3fd33ecff7472e4d6fc9e6b3905f56982e497ef2 (diff) | |
[fix]: generalize render targets and window seams
Diffstat (limited to 'src/platform/opengl')
| -rw-r--r-- | src/platform/opengl/opengl_device.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/platform/opengl/opengl_device.cpp b/src/platform/opengl/opengl_device.cpp index 3d45d24..c4332fa 100644 --- a/src/platform/opengl/opengl_device.cpp +++ b/src/platform/opengl/opengl_device.cpp @@ -205,17 +205,17 @@ namespace Donut::RHI class GLDevice : public Device { public: - auto init(void* window, int width, int height) -> bool override + auto init(const NativeWindow& window) -> bool override { - m_window = window; - glfwMakeContextCurrent(static_cast<GLFWwindow*>(window)); + m_window = window.glfw_handle; + glfwMakeContextCurrent(static_cast<GLFWwindow*>(m_window)); if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) { DONUT_ERROR("GL RHI: GLAD load failed"); return false; } - m_width = width; m_height = height; + m_width = window.width; m_height = window.height; const char* name = (const char*)glGetString(GL_RENDERER); m_name = name ? name : "OpenGL"; glGenVertexArrays(1, &m_vao); glBindVertexArray(m_vao); // GL core needs one bound VAO m_cmds = create_scope<GLCommandList>(m_vao); - DONUT_INFO("GL RHI device: {} ({}x{})", m_name, width, height); + DONUT_INFO("GL RHI device: {} ({}x{})", m_name, m_width, m_height); return true; } auto shutdown() -> void override @@ -235,8 +235,8 @@ namespace Donut::RHI HDRIManager::get().set_current_hdri(path); return create_ref<GLTexture>(HDRIManager::get().get_current_hdri()); } - auto create_render_target(int w, int h, Format color, bool depth, Filter fl, int /*mips*/) -> Ref<RenderTarget> override - { return create_ref<GLRenderTarget>(w, h, color, depth, fl); } + auto create_render_target(int w, int h, Format color, Format depth, Filter fl, int /*mips*/) -> Ref<RenderTarget> override + { return create_ref<GLRenderTarget>(w, h, color, depth != Format::None, fl); } auto create_pipeline(const PipelineDesc& d) -> Ref<Pipeline> override { return create_ref<GLPipeline>(d); } |
