diff --git a/libs/gfx/include/psemek/gfx/framebuffer.hpp b/libs/gfx/include/psemek/gfx/framebuffer.hpp index bce4f2ce..2ad4ba48 100644 --- a/libs/gfx/include/psemek/gfx/framebuffer.hpp +++ b/libs/gfx/include/psemek/gfx/framebuffer.hpp @@ -34,17 +34,20 @@ namespace psemek::gfx void color(texture_1d const & tex, int attachment = 0); void color(texture_2d const & tex, int attachment = 0); + void color(texture_2d_multisample const & tex, int attachment = 0); void color(texture_3d const & tex, int layer, int attachment = 0); void color(texture_2d_array const & tex, int layer, int attachment = 0); void color(texture_cubemap const & tex, int attachment = 0); 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_multisample 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_multisample 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); diff --git a/libs/gfx/source/framebuffer.cpp b/libs/gfx/source/framebuffer.cpp index 40cd41b4..c01d462a 100644 --- a/libs/gfx/source/framebuffer.cpp +++ b/libs/gfx/source/framebuffer.cpp @@ -70,19 +70,25 @@ namespace psemek::gfx void framebuffer::color(texture_1d const & tex, int attachment) { bind(); - gl::FramebufferTexture2D(gl::DRAW_FRAMEBUFFER, gl::COLOR_ATTACHMENT0 + attachment, gl::TEXTURE_1D, tex.id(), 0); + gl::FramebufferTexture2D(gl::DRAW_FRAMEBUFFER, gl::COLOR_ATTACHMENT0 + attachment, tex.target, tex.id(), 0); } void framebuffer::color(texture_2d const & tex, int attachment) { bind(); - gl::FramebufferTexture2D(gl::DRAW_FRAMEBUFFER, gl::COLOR_ATTACHMENT0 + attachment, gl::TEXTURE_2D, tex.id(), 0); + gl::FramebufferTexture2D(gl::DRAW_FRAMEBUFFER, gl::COLOR_ATTACHMENT0 + attachment, tex.target, tex.id(), 0); + } + + void framebuffer::color(texture_2d_multisample const & tex, int attachment) + { + bind(); + gl::FramebufferTexture2D(gl::DRAW_FRAMEBUFFER, gl::COLOR_ATTACHMENT0 + attachment, tex.target, tex.id(), 0); } void framebuffer::color(texture_3d const & tex, int layer, int attachment) { bind(); - gl::FramebufferTexture3D(gl::DRAW_FRAMEBUFFER, gl::COLOR_ATTACHMENT0 + attachment, gl::TEXTURE_3D, tex.id(), 0, layer); + gl::FramebufferTexture3D(gl::DRAW_FRAMEBUFFER, gl::COLOR_ATTACHMENT0 + attachment, tex.target, tex.id(), 0, layer); } void framebuffer::color(texture_2d_array const & tex, int layer, int attachment) @@ -112,7 +118,13 @@ namespace psemek::gfx void framebuffer::depth(texture_2d const & tex) { bind(); - gl::FramebufferTexture2D(gl::DRAW_FRAMEBUFFER, gl::DEPTH_ATTACHMENT, gl::TEXTURE_2D, tex.id(), 0); + gl::FramebufferTexture2D(gl::DRAW_FRAMEBUFFER, gl::DEPTH_ATTACHMENT, tex.target, tex.id(), 0); + } + + void framebuffer::depth(texture_2d_multisample const & tex) + { + bind(); + gl::FramebufferTexture2D(gl::DRAW_FRAMEBUFFER, gl::DEPTH_ATTACHMENT, tex.target, tex.id(), 0); } void framebuffer::depth(texture_2d_array const & tex, int layer) @@ -142,7 +154,13 @@ namespace psemek::gfx void framebuffer::depth_stencil(texture_2d const & tex) { bind(); - gl::FramebufferTexture2D(gl::DRAW_FRAMEBUFFER, gl::DEPTH_STENCIL_ATTACHMENT, gl::TEXTURE_2D, tex.id(), 0); + gl::FramebufferTexture2D(gl::DRAW_FRAMEBUFFER, gl::DEPTH_STENCIL_ATTACHMENT, tex.target, tex.id(), 0); + } + + void framebuffer::depth_stencil(texture_2d_multisample const & tex) + { + bind(); + gl::FramebufferTexture2D(gl::DRAW_FRAMEBUFFER, gl::DEPTH_STENCIL_ATTACHMENT, tex.target, tex.id(), 0); } void framebuffer::depth_stencil(texture_2d_array const & tex, int layer)