Merge pull request #15956 from ricardoquesada/issue15934_312

fix: FPS appears on iOS
This commit is contained in:
minggo 2016-06-27 10:15:12 +08:00 committed by GitHub
commit a052dd34d0
1 changed files with 8 additions and 0 deletions

View File

@ -256,6 +256,14 @@ void Director::setGLDefaultValues()
setAlphaBlending(true); setAlphaBlending(true);
setDepthTest(false); setDepthTest(false);
setProjection(_projection); setProjection(_projection);
// Everything should be drawn within `Scene::render()`.
// Otherwise it might not render correctly since the GL state might not be the correct one
// so the FPS should be part of Scene. But until we move them there, this little hack is to
// set the default glViewPort(), so that when `Scene::render()` exits, the viewport is the correct
// one for the FPS
auto vp = Camera::getDefaultViewport();
glViewport(vp._left, vp._bottom, vp._width, vp._height);
} }
// Draw the Scene // Draw the Scene