small refactoring
This commit is contained in:
@@ -21,8 +21,8 @@
|
||||
#include <QTime>
|
||||
|
||||
|
||||
Framebuffer::Framebuffer(QOpenGLExtraFunctions * f_, int colorAttachments_, bool withDepth, GLenum colorFormat_, GLenum _target): f(f_),
|
||||
pbo(GL_PIXEL_PACK_BUFFER, GL_STREAM_DRAW) {
|
||||
Framebuffer::Framebuffer(QOpenGLExtraFunctions * f_, int colorAttachments_, bool withDepth, GLenum colorFormat_, GLenum _target)
|
||||
: f(f_), pbo(GL_PIXEL_PACK_BUFFER, GL_STREAM_DRAW) {
|
||||
is_depth = withDepth;
|
||||
target_ = _target;
|
||||
color_formats.fill(colorFormat_, colorAttachments_);
|
||||
@@ -35,8 +35,8 @@ Framebuffer::Framebuffer(QOpenGLExtraFunctions * f_, int colorAttachments_, bool
|
||||
}
|
||||
|
||||
|
||||
Framebuffer::Framebuffer(QOpenGLExtraFunctions * f_, QVector<GLenum> colors_, bool withDepth, GLenum _target): f(f_),
|
||||
pbo(GL_PIXEL_PACK_BUFFER, GL_STREAM_DRAW) {
|
||||
Framebuffer::Framebuffer(QOpenGLExtraFunctions * f_, QVector<GLenum> colors_, bool withDepth, GLenum _target)
|
||||
: f(f_), pbo(GL_PIXEL_PACK_BUFFER, GL_STREAM_DRAW) {
|
||||
is_depth = withDepth;
|
||||
target_ = _target;
|
||||
color_formats = colors_;
|
||||
@@ -73,7 +73,6 @@ void Framebuffer::resize(int width, int height, bool force) {
|
||||
f->glTexParameteri(target_, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
f->glTexParameteri(target_, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
f->glTexParameteri(target_, GL_TEXTURE_MAX_LEVEL, 4);
|
||||
//f->glTexParameteri(target_, GL_GENERATE_MIPMAP_SGIS, GL_FALSE);
|
||||
f->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, target_, colors[i], 0);
|
||||
}
|
||||
if (is_depth) {
|
||||
@@ -88,7 +87,6 @@ void Framebuffer::resize(int width, int height, bool force) {
|
||||
f->glTexParameteri(target_, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
f->glTexParameteri(target_, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
f->glTexParameteri(target_, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
//f->glTexParameteri(target_, GL_GENERATE_MIPMAP_SGIS, GL_FALSE);
|
||||
f->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, target_, tex_d, 0);
|
||||
}
|
||||
f->glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
@@ -289,8 +287,6 @@ void Framebuffer::bindColorTextures() {
|
||||
for (int i = colors.size() - 1; i >= 0; --i) {
|
||||
f->glActiveTexture(GL_TEXTURE0 + i);
|
||||
f->glBindTexture(GL_TEXTURE_2D, colors[i]);
|
||||
//f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
//f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user