From f2f6cfd77c40448c229106b60fcee4e70d59abb9 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 5 Sep 2016 13:43:10 +0200 Subject: [PATCH] #279 Access single quad rendering as member of caf::Viewer --- Fwk/AppFwk/cafViewer/cafViewer.cpp | 9 +++------ Fwk/AppFwk/cafViewer/cafViewer.h | 1 + 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Fwk/AppFwk/cafViewer/cafViewer.cpp b/Fwk/AppFwk/cafViewer/cafViewer.cpp index a9b128b256..3d742bf7f8 100644 --- a/Fwk/AppFwk/cafViewer/cafViewer.cpp +++ b/Fwk/AppFwk/cafViewer/cafViewer.cpp @@ -227,8 +227,8 @@ void caf::Viewer::setupRenderingSequence() quadRenderGen.addFragmentShaderCode(cvf::ShaderSourceProvider::instance()->getSourceFromRepository(cvf::ShaderSourceRepository::fs_Unlit)); quadRenderGen.addFragmentShaderCode(cvf::ShaderSourceProvider::instance()->getSourceFromRepository(cvf::ShaderSourceRepository::src_Texture)); - cvf::ref quadRendering = quadRenderGen.generate(); - m_renderingSequence->addRendering(quadRendering.p()); + m_quadRendering = quadRenderGen.generate(); + m_renderingSequence->addRendering(m_quadRendering.p()); } updateCamera(width(), height()); @@ -508,10 +508,7 @@ void caf::Viewer::resizeGL(int width, int height) { m_offscreenFbo->resizeAttachedBuffers(width, height); - CVF_ASSERT(m_renderingSequence->renderingCount() > 1); - - cvf::ref quadRendering = m_renderingSequence->rendering(1); - quadRendering->camera()->viewport()->set(0, 0, width, height); + m_quadRendering->camera()->viewport()->set(0, 0, width, height); } updateCamera(width, height); diff --git a/Fwk/AppFwk/cafViewer/cafViewer.h b/Fwk/AppFwk/cafViewer/cafViewer.h index 52eb2e8720..fdbc200b78 100644 --- a/Fwk/AppFwk/cafViewer/cafViewer.h +++ b/Fwk/AppFwk/cafViewer/cafViewer.h @@ -231,6 +231,7 @@ private: // Offscreen render objects cvf::ref m_offscreenFbo; cvf::ref m_offscreenTexture; + cvf::ref m_quadRendering; }; } // End namespace caf