get image function
This commit is contained in:
17
renderer.cpp
17
renderer.cpp
@@ -85,6 +85,7 @@ void Renderer::init(int width, int height) {
|
||||
initCoeffTextures();
|
||||
markReloadTextures();
|
||||
tex_env.init();
|
||||
if (is_grabbing) fbo_out.enablePixelBuffer();
|
||||
need_init_shaders = true;
|
||||
}
|
||||
|
||||
@@ -347,18 +348,18 @@ void Renderer::renderScene() {
|
||||
}
|
||||
|
||||
/// tonemapping
|
||||
if (tone_proc.process()) fbo_out.bind();
|
||||
tone_proc.process();
|
||||
if (bindShader(srTonemapPass, &prog)) {
|
||||
fbo_out.bind();
|
||||
prog->setUniformValue("gamma", gamma_);
|
||||
prog->setUniformValue("frame_max", tone_proc.frameMax());
|
||||
fbo_out.bindColorTexture(obrSum, 0);
|
||||
fbo_out.setWriteBuffer(obrTonemap);
|
||||
renderQuad(prog, quad);
|
||||
fbo_out.release();
|
||||
} else {
|
||||
fbo_out.blit(obrSum, fbo_out.id(), obrTonemap, fbo_out.rect(), fbo_out.rect());
|
||||
}
|
||||
//glClearFramebuffer(Qt::red, false);
|
||||
fbo_out.release();
|
||||
|
||||
/// apply hovers and selection frame
|
||||
if (edit_mode) {
|
||||
@@ -367,6 +368,11 @@ void Renderer::renderScene() {
|
||||
} else {
|
||||
fbo_out.blit(obrTonemap, 0, 0, fbo_out.rect(), QRect(QPoint(), view->size()));
|
||||
}
|
||||
if (is_grabbing) {
|
||||
fbo_out.queryImage(0);
|
||||
last_img = fbo_out.getImage().mirrored();
|
||||
//qDebug() << last_img.size();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -374,3 +380,8 @@ void Renderer::setCameraLightMode(int m) {
|
||||
camera_light_mode = m;
|
||||
view->scene()->setLightsChanged();
|
||||
}
|
||||
|
||||
void Renderer::setGrabImage(bool on) {
|
||||
is_grabbing = on;
|
||||
//fbo_out.enablePixelBuffer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user