16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-19 04:19:19 +02:00

multisampling

This commit is contained in:
milek7
2018-07-13 00:32:25 +02:00
parent c94820e8b7
commit 0acf2da5c1
10 changed files with 96 additions and 52 deletions

View File

@@ -19,7 +19,7 @@ void gl::framebuffer::bind(GLuint id)
void gl::framebuffer::attach(const opengl_texture &tex, GLenum location)
{
bind();
glFramebufferTexture2D(GL_FRAMEBUFFER, location, GL_TEXTURE_2D, tex.id, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, location, tex.target, tex.id, 0);
}
void gl::framebuffer::attach(const renderbuffer &rb, GLenum location)
@@ -35,8 +35,21 @@ bool gl::framebuffer::is_complete()
return status == GL_FRAMEBUFFER_COMPLETE;
}
void gl::framebuffer::clear()
void gl::framebuffer::clear(GLbitfield mask)
{
bind();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClear(mask);
}
void gl::framebuffer::blit_to(framebuffer &other, int w, int h, GLbitfield mask)
{
glBindFramebuffer(GL_READ_FRAMEBUFFER, *this);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, other);
glBlitFramebuffer(0, 0, w, h, 0, 0, w, h, mask, GL_NEAREST);
unbind();
}
void gl::framebuffer::blit_from(framebuffer &other, int w, int h, GLbitfield mask)
{
other.blit_to(*this, w, h, mask);
}