Support all texture types for framebuffer color target
This commit is contained in:
parent
5e344c408f
commit
d8069308ee
2 changed files with 21 additions and 0 deletions
|
|
@ -24,7 +24,10 @@ namespace psemek::gfx
|
|||
|
||||
void bind() const;
|
||||
|
||||
void color(texture_1d const & tex, int attachment = 0);
|
||||
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(renderbuffer const & rb, int attachment = 0);
|
||||
void depth(renderbuffer const & rb);
|
||||
|
||||
|
|
|
|||
|
|
@ -57,12 +57,30 @@ namespace psemek::gfx
|
|||
gl::BindFramebuffer(gl::DRAW_FRAMEBUFFER, id_);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void framebuffer::color(texture_2d_array const & tex, int layer, int attachment)
|
||||
{
|
||||
bind();
|
||||
gl::FramebufferTextureLayer(gl::DRAW_FRAMEBUFFER, gl::COLOR_ATTACHMENT0 + attachment, tex.id(), 0, layer);
|
||||
}
|
||||
|
||||
void framebuffer::color(renderbuffer const & rb, int attachment)
|
||||
{
|
||||
bind();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue