code format
This commit is contained in:
@@ -20,13 +20,13 @@
|
||||
|
||||
|
||||
GLFramebuffer::GLFramebuffer(int colorAttachments_, bool withDepth, GLenum colorFormat_, GLenum target__) {
|
||||
is_depth = withDepth;
|
||||
is_depth = withDepth;
|
||||
color_format = colorFormat_;
|
||||
target_ = target__;
|
||||
target_ = target__;
|
||||
colors.fill(0, colorAttachments_);
|
||||
fbo = drbo = 0;
|
||||
tex_d = 0;
|
||||
wid = hei = 0;
|
||||
tex_d = 0;
|
||||
wid = hei = 0;
|
||||
is_changed = false;
|
||||
}
|
||||
|
||||
@@ -80,8 +80,8 @@ void GLFramebuffer::resize(int width, int height, bool force) {
|
||||
|
||||
|
||||
QImage GLFramebuffer::grab() const {
|
||||
//glReadPixels(0, 0, wid, hei, GL_RGBA, );
|
||||
//QImage ret();
|
||||
// glReadPixels(0, 0, wid, hei, GL_RGBA, );
|
||||
// QImage ret();
|
||||
return QImage();
|
||||
}
|
||||
|
||||
@@ -90,17 +90,17 @@ void GLFramebuffer::bind() {
|
||||
if (is_changed) resize(wid, hei);
|
||||
if (fbo == 0) return;
|
||||
initializeOpenGLFunctions();
|
||||
//glFlush();
|
||||
// glFlush();
|
||||
glGetIntegerv(GL_VIEWPORT, prev_view);
|
||||
//glClearError();
|
||||
// glClearError();
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||
//qDebug() << QString::number(glGetError(), 16);
|
||||
// qDebug() << QString::number(glGetError(), 16);
|
||||
QVector<GLenum> buffers;
|
||||
for (int i = 0; i < colors.size(); ++i)
|
||||
buffers << GL_COLOR_ATTACHMENT0 + i;
|
||||
glDrawBuffers(buffers.size(), buffers.constData());
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT0);
|
||||
//glDrawBuffer(GL_COLOR_ATTACHMENT0);
|
||||
// glDrawBuffer(GL_COLOR_ATTACHMENT0);
|
||||
glViewport(0, 0, wid, hei);
|
||||
}
|
||||
|
||||
@@ -108,17 +108,17 @@ void GLFramebuffer::bind() {
|
||||
void GLFramebuffer::release() {
|
||||
is_changed = false;
|
||||
if (fbo == 0) return;
|
||||
//glFlush();
|
||||
// glFlush();
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glViewport(prev_view[0], prev_view[1], prev_view[2], prev_view[3]);
|
||||
}
|
||||
|
||||
|
||||
void GLFramebuffer::setWriteBuffer(int index) {
|
||||
//QVector<GLenum> buffers; buffers << GL_COLOR_ATTACHMENT0 + index;
|
||||
// QVector<GLenum> buffers; buffers << GL_COLOR_ATTACHMENT0 + index;
|
||||
GLenum e = GL_COLOR_ATTACHMENT0 + index;
|
||||
glDrawBuffer(e);
|
||||
//glDrawBuffers(1, &e);
|
||||
// glDrawBuffers(1, &e);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user