Trash-Texture on empty model.

This commit is contained in:
rachytski 2011-01-26 02:35:12 +02:00 committed by Alex Zolotarev
parent 36b7db76d4
commit d4182c31a2
4 changed files with 25 additions and 12 deletions

View file

@ -80,19 +80,23 @@ void RenderQueueRoutine::processResize(ScreenBase const & /*frameScreen*/)
m_renderState->m_actualTarget.reset();
m_renderState->m_actualTarget = make_shared_ptr(new yg::gl::RawRGBA8Texture(texW, texH));
m_threadDrawer->screen()->setRenderTarget(m_renderState->m_actualTarget);
m_threadDrawer->screen()->beginFrame();
m_threadDrawer->screen()->clear();
m_threadDrawer->screen()->endFrame();
m_auxScreen->onSize(texW, texH);
m_auxScreen->setRenderTarget(m_renderState->m_actualTarget);
m_auxScreen->beginFrame();
m_auxScreen->clear();
m_auxScreen->endFrame();
// m_renderState->m_actualTarget->fill(yg::Color(192, 192, 192, 255));
for (size_t i = 0; i < m_renderState->m_backBufferLayers.size(); ++i)
{
m_threadDrawer->screen()->setRenderTarget(m_renderState->m_backBufferLayers[i]);
m_threadDrawer->screen()->beginFrame();
m_threadDrawer->screen()->clear();
m_threadDrawer->screen()->endFrame();
m_auxScreen->setRenderTarget(m_renderState->m_backBufferLayers[i]);
m_auxScreen->beginFrame();
m_auxScreen->clear();
m_auxScreen->endFrame();
}
// m_renderState->m_backBufferLayers[i]->fill(yg::Color(192, 192, 192, 255));
m_renderState->m_doRepaintAll = true;
m_renderState->m_isResized = false;
@ -105,12 +109,12 @@ void RenderQueueRoutine::getUpdateAreas(vector<m2::RectI> & areas)
size_t w = m_renderState->m_textureWidth;
size_t h = m_renderState->m_textureHeight;
/* if (m_renderState->m_doRepaintAll)
if (m_renderState->m_doRepaintAll)
{
m_renderState->m_doRepaintAll = false;
areas.push_back(m2::RectI(0, 0, w, h));
return;
}*/
}
if (m_renderState->isPanning())
{
@ -220,6 +224,12 @@ void RenderQueueRoutine::Do()
params.m_doPeriodicalUpdate = m_doPeriodicalUpdate;
m_threadDrawer = make_shared_ptr(new DrawerYG(m_skinName, params));
yg::gl::Screen::Params auxParams;
auxParams.m_frameBuffer = m_frameBuffer;
m_auxScreen = make_shared_ptr(new yg::gl::Screen(auxParams));
CHECK(m_visualScale != 0, ("Set the VisualScale first!"));
m_threadDrawer->SetVisualScale(m_visualScale);

View file

@ -31,6 +31,7 @@ namespace yg
class BaseTexture;
class RenderState;
class RenderState;
class Screen;
}
}
@ -57,6 +58,7 @@ private:
shared_ptr<yg::gl::RenderContext> m_renderContext;
shared_ptr<yg::gl::FrameBuffer> m_frameBuffer;
shared_ptr<DrawerYG> m_threadDrawer;
shared_ptr<yg::gl::Screen> m_auxScreen;
threads::Condition m_hasRenderCommands;
shared_ptr<RenderModelCommand> m_currentRenderCommand;

View file

@ -100,7 +100,7 @@ namespace yg
void RenderStateUpdater::endFrame()
{
if (m_indicesCount && m_renderState)
if (m_renderState)
updateActualTarget();
base_t::endFrame();
}

View file

@ -95,9 +95,9 @@ namespace yg
OGLCHECK(glResolveMultisampleFramebufferAPPLE());
OGLCHECK(glBindFramebufferOES(GL_DRAW_FRAMEBUFFER_APPLE, m_multiSampledFrameBuffer->id()));
#else
/// Somehow this does the trick with the "trash-texture" upon first application redraw.
m_multiSampledFrameBuffer->makeCurrent();
OGLCHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_multiSampledFrameBuffer->id()));
OGLCHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_frameBuffer->id()));
@ -108,6 +108,7 @@ namespace yg
OGLCHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_multiSampledFrameBuffer->id()));
#endif
// m_multiSampledFrameBuffer->makeCurrent();
OGLCHECK(glFinish());
}
}