diff --git a/libs/gfx/include/psemek/gfx/framebuffer.hpp b/libs/gfx/include/psemek/gfx/framebuffer.hpp index d781cb17..74e7595d 100644 --- a/libs/gfx/include/psemek/gfx/framebuffer.hpp +++ b/libs/gfx/include/psemek/gfx/framebuffer.hpp @@ -38,10 +38,12 @@ namespace psemek::gfx void color(texture_cubemap const & tex, int face, int attachment = 0); void color(renderbuffer const & rb, int attachment = 0); void depth(texture_2d const & tex); + void depth(texture_2d_array const & tex, int layer); void depth(texture_cubemap const & tex); void depth(texture_cubemap const & tex, int face); void depth(renderbuffer const & rb); void depth_stencil(texture_2d const & tex); + void depth_stencil(texture_2d_array const & tex, int layer); void depth_stencil(texture_cubemap const & tex); void depth_stencil(texture_cubemap const & tex, int face); void depth_stencil(renderbuffer const & rb); diff --git a/libs/gfx/source/framebuffer.cpp b/libs/gfx/source/framebuffer.cpp index 6ac82cde..bf597532 100644 --- a/libs/gfx/source/framebuffer.cpp +++ b/libs/gfx/source/framebuffer.cpp @@ -113,6 +113,12 @@ namespace psemek::gfx gl::FramebufferTexture2D(gl::DRAW_FRAMEBUFFER, gl::DEPTH_ATTACHMENT, gl::TEXTURE_2D, tex.id(), 0); } + void framebuffer::depth(texture_2d_array const & tex, int layer) + { + bind(); + gl::FramebufferTextureLayer(gl::DRAW_FRAMEBUFFER, gl::DEPTH_ATTACHMENT, tex.id(), 0, layer); + } + void framebuffer::depth(texture_cubemap const & tex) { bind(); @@ -137,6 +143,12 @@ namespace psemek::gfx gl::FramebufferTexture2D(gl::DRAW_FRAMEBUFFER, gl::DEPTH_STENCIL_ATTACHMENT, gl::TEXTURE_2D, tex.id(), 0); } + void framebuffer::depth_stencil(texture_2d_array const & tex, int layer) + { + bind(); + gl::FramebufferTextureLayer(gl::DRAW_FRAMEBUFFER, gl::DEPTH_STENCIL_ATTACHMENT, tex.id(), 0, layer); + } + void framebuffer::depth_stencil(texture_cubemap const & tex) { bind();