Support cubemap textures as framebuffer attachments
This commit is contained in:
parent
6b6d7687a9
commit
226192e264
2 changed files with 42 additions and 0 deletions
|
|
@ -31,10 +31,16 @@ namespace psemek::gfx
|
|||
void color(texture_2d 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_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_cubemap const & tex);
|
||||
void depth_stencil(texture_cubemap const & tex, int face);
|
||||
void depth_stencil(renderbuffer const & rb);
|
||||
|
||||
GLenum status() const;
|
||||
|
|
|
|||
|
|
@ -84,6 +84,18 @@ namespace psemek::gfx
|
|||
gl::FramebufferTextureLayer(gl::DRAW_FRAMEBUFFER, gl::COLOR_ATTACHMENT0 + attachment, tex.id(), 0, layer);
|
||||
}
|
||||
|
||||
void framebuffer::color(texture_cubemap const & tex, int attachment)
|
||||
{
|
||||
bind();
|
||||
gl::FramebufferTexture(gl::DRAW_FRAMEBUFFER, gl::COLOR_ATTACHMENT0 + attachment, tex.id(), 0);
|
||||
}
|
||||
|
||||
void framebuffer::color(texture_cubemap const & tex, int face, int attachment)
|
||||
{
|
||||
bind();
|
||||
gl::FramebufferTexture2D(gl::DRAW_FRAMEBUFFER, gl::COLOR_ATTACHMENT0 + attachment, texture_cubemap::face_to_gl(face), tex.id(), 0);
|
||||
}
|
||||
|
||||
void framebuffer::color(renderbuffer const & rb, int attachment)
|
||||
{
|
||||
bind();
|
||||
|
|
@ -96,6 +108,18 @@ namespace psemek::gfx
|
|||
gl::FramebufferTexture2D(gl::DRAW_FRAMEBUFFER, gl::DEPTH_ATTACHMENT, gl::TEXTURE_2D, tex.id(), 0);
|
||||
}
|
||||
|
||||
void framebuffer::depth(texture_cubemap const & tex)
|
||||
{
|
||||
bind();
|
||||
gl::FramebufferTexture(gl::DRAW_FRAMEBUFFER, gl::DEPTH_ATTACHMENT, tex.id(), 0);
|
||||
}
|
||||
|
||||
void framebuffer::depth(texture_cubemap const & tex, int face)
|
||||
{
|
||||
bind();
|
||||
gl::FramebufferTexture2D(gl::DRAW_FRAMEBUFFER, gl::DEPTH_ATTACHMENT, texture_cubemap::face_to_gl(face), tex.id(), 0);
|
||||
}
|
||||
|
||||
void framebuffer::depth(renderbuffer const & rb)
|
||||
{
|
||||
bind();
|
||||
|
|
@ -108,6 +132,18 @@ namespace psemek::gfx
|
|||
gl::FramebufferTexture2D(gl::DRAW_FRAMEBUFFER, gl::DEPTH_STENCIL_ATTACHMENT, gl::TEXTURE_2D, tex.id(), 0);
|
||||
}
|
||||
|
||||
void framebuffer::depth_stencil(texture_cubemap const & tex)
|
||||
{
|
||||
bind();
|
||||
gl::FramebufferTexture(gl::DRAW_FRAMEBUFFER, gl::DEPTH_STENCIL_ATTACHMENT, tex.id(), 0);
|
||||
}
|
||||
|
||||
void framebuffer::depth_stencil(texture_cubemap const & tex, int face)
|
||||
{
|
||||
bind();
|
||||
gl::FramebufferTexture2D(gl::DRAW_FRAMEBUFFER, gl::DEPTH_STENCIL_ATTACHMENT, texture_cubemap::face_to_gl(face), tex.id(), 0);
|
||||
}
|
||||
|
||||
void framebuffer::depth_stencil(renderbuffer const & rb)
|
||||
{
|
||||
bind();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue