mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
post-processing test
This commit is contained in:
parent
e7af5830cf
commit
8ed65ca51e
13 changed files with 268 additions and 113 deletions
|
|
@ -23,7 +23,7 @@ Framebuffer::Framebuffer(uint width, uint height, bool alpha)
|
|||
|
||||
// Setup color attachment (texture)
|
||||
GLuint tex;
|
||||
GLuint format = alpha ? GL_RGBA : GL_RGB;
|
||||
format = alpha ? GL_RGBA : GL_RGB;
|
||||
glGenTextures(1, &tex);
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, nullptr);
|
||||
|
|
@ -55,6 +55,16 @@ void Framebuffer::unbind() {
|
|||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
void Framebuffer::resize(uint width, uint height) {
|
||||
if (this->width == width && this->height == height) {
|
||||
return;
|
||||
}
|
||||
GLuint texid = texture->getId();
|
||||
texture->bind();
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, nullptr);
|
||||
texture->unbind();
|
||||
}
|
||||
|
||||
Texture* Framebuffer::getTexture() const {
|
||||
return texture.get();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue