Disabling the framebuffer blit of output rendering

Blit of framebuffer is incompatible with the new features of Display View to adjust whitebalance and geometry of rendered frame on output windows.
This commit is contained in:
Bruno Herbelin
2023-02-28 00:23:54 +01:00
parent f9e99e2a33
commit 93f433f388
5 changed files with 5 additions and 74 deletions

View File

@@ -1096,69 +1096,11 @@ bool RenderingWindow::draw(FrameBuffer *fb)
Rendering::manager().pushAttrib(window_attributes_);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// blit framebuffer
if (Settings::application.render.blit) {
if ( textureid_ != fb->texture()) {
textureid_ = fb->texture();
// create a new fbo in this opengl context
if (fbo_ != 0)
glDeleteFramebuffers(1, &fbo_);
glGenFramebuffers(1, &fbo_);
glBindFramebuffer(GL_FRAMEBUFFER, fbo_);
// attach the 2D texture to local FBO
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureid_, 0);
#ifndef NDEBUG
Log::Info("Blit to output window enabled.");
#endif
}
// if not disabled
if (!Settings::application.render.disabled) {
// calculate scaling factor of frame buffer inside window
int rx, ry, rw, rh;
float renderingAspectRatio = fb->aspectRatio();
if (Settings::application.windows[index_].scaled) {
rx = 0;
ry = 0;
rw = window_attributes_.viewport.x;
rh = window_attributes_.viewport.y;
}
else {
if (aspectRatio() < renderingAspectRatio) {
int nh = (int)( float(window_attributes_.viewport.x) / renderingAspectRatio);
rx = 0;
ry = (window_attributes_.viewport.y - nh) / 2;
rw = window_attributes_.viewport.x;
rh = (window_attributes_.viewport.y + nh) / 2;
} else {
int nw = (int)( float(window_attributes_.viewport.y) * renderingAspectRatio );
rx = (window_attributes_.viewport.x - nw) / 2;
ry = 0;
rw = (window_attributes_.viewport.x + nw) / 2;
rh = window_attributes_.viewport.y;
}
}
// select fbo texture read target
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo_);
// select screen target
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
// blit operation from fbo (containing texture) to screen
glBlitFramebuffer(0, fb->height(), fb->width(), 0, rx, ry, rw, rh, GL_COLOR_BUFFER_BIT, GL_LINEAR);
}
}
// make sure previous shader in another glcontext is disabled
ShadingProgram::enduse();
// draw geometry
else if (!Settings::application.render.disabled)
if (!Settings::application.render.disabled)
{
// VAO is not shared between multiple contexts of different windows
// so we have to create a new VAO for rendering the surface in this window