#279 Access single quad rendering as member of caf::Viewer

This commit is contained in:
Magne Sjaastad 2016-09-05 13:43:10 +02:00
parent a83e797e63
commit f2f6cfd77c
2 changed files with 4 additions and 6 deletions

View File

@ -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::fs_Unlit));
quadRenderGen.addFragmentShaderCode(cvf::ShaderSourceProvider::instance()->getSourceFromRepository(cvf::ShaderSourceRepository::src_Texture)); quadRenderGen.addFragmentShaderCode(cvf::ShaderSourceProvider::instance()->getSourceFromRepository(cvf::ShaderSourceRepository::src_Texture));
cvf::ref<cvf::Rendering> quadRendering = quadRenderGen.generate(); m_quadRendering = quadRenderGen.generate();
m_renderingSequence->addRendering(quadRendering.p()); m_renderingSequence->addRendering(m_quadRendering.p());
} }
updateCamera(width(), height()); updateCamera(width(), height());
@ -508,10 +508,7 @@ void caf::Viewer::resizeGL(int width, int height)
{ {
m_offscreenFbo->resizeAttachedBuffers(width, height); m_offscreenFbo->resizeAttachedBuffers(width, height);
CVF_ASSERT(m_renderingSequence->renderingCount() > 1); m_quadRendering->camera()->viewport()->set(0, 0, width, height);
cvf::ref<cvf::Rendering> quadRendering = m_renderingSequence->rendering(1);
quadRendering->camera()->viewport()->set(0, 0, width, height);
} }
updateCamera(width, height); updateCamera(width, height);

View File

@ -231,6 +231,7 @@ private:
// Offscreen render objects // Offscreen render objects
cvf::ref<cvf::FramebufferObject> m_offscreenFbo; cvf::ref<cvf::FramebufferObject> m_offscreenFbo;
cvf::ref<cvf::Texture> m_offscreenTexture; cvf::ref<cvf::Texture> m_offscreenTexture;
cvf::ref<cvf::Rendering> m_quadRendering;
}; };
} // End namespace caf } // End namespace caf