render fix
This commit is contained in:
parent
44a7f6ab90
commit
8ef534e7b7
|
@ -90,12 +90,19 @@ void Engine::run()
|
|||
}
|
||||
}
|
||||
|
||||
render();
|
||||
// render
|
||||
g_graphics.beginRender();
|
||||
|
||||
if(m_currentState)
|
||||
m_currentState->render();
|
||||
UIContainer::getRootContainer()->render();
|
||||
|
||||
// render fps
|
||||
if(m_calculateFps)
|
||||
defaultFont->renderText(fpsText, Point(g_graphics.getScreenSize().width() - fpsTextSize.width() - 10, 10));
|
||||
|
||||
g_graphics.endRender();
|
||||
|
||||
// swap buffers
|
||||
Platform::swapBuffers();
|
||||
}
|
||||
|
@ -119,15 +126,6 @@ void Engine::changeState(GameState* newState)
|
|||
m_currentState->onEnter();
|
||||
}
|
||||
|
||||
void Engine::render()
|
||||
{
|
||||
g_graphics.beginRender();
|
||||
if(m_currentState)
|
||||
m_currentState->render();
|
||||
UIContainer::getRootContainer()->render();
|
||||
g_graphics.endRender();
|
||||
}
|
||||
|
||||
void Engine::onClose()
|
||||
{
|
||||
if(m_currentState)
|
||||
|
|
|
@ -65,9 +65,6 @@ public:
|
|||
int getCurrentFrameTicks() const { return m_lastFrameTicks; }
|
||||
|
||||
private:
|
||||
/// Called to render every frame
|
||||
void render();
|
||||
|
||||
bool m_stopping;
|
||||
bool m_running;
|
||||
bool m_calculateFps;
|
||||
|
|
|
@ -41,6 +41,7 @@ void Graphics::init()
|
|||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
||||
glShadeModel(GL_SMOOTH);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
logInfo("GPU %s", (const char*)glGetString(GL_RENDERER));
|
||||
logInfo("OpenGL %s", (const char*)glGetString(GL_VERSION));
|
||||
|
@ -115,7 +116,6 @@ void Graphics::restoreViewport()
|
|||
|
||||
void Graphics::beginRender()
|
||||
{
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glLoadIdentity();
|
||||
|
||||
|
|
Loading…
Reference in New Issue