fix initialization opengl glitch

master
Eduardo Bart 12 years ago
parent 75f8b255ec
commit 576e775494

@ -208,6 +208,7 @@ void Application::run()
m_foregroundFrameCounter.processNextFrame();
// draw foreground
g_painter->clearScreen();
g_ui.render(true);
// copy the foreground to a texture

@ -86,10 +86,6 @@ void Graphics::init()
glEnable(GL_CULL_FACE);
*/
// clear color buffer
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
// determine max texture size
GLint maxTextureSize = 0;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);

@ -86,6 +86,12 @@ void Painter::restoreSavedState()
setTexture(m_olderStates[m_oldStateIndex].texture);
}
void Painter::clearScreen()
{
glClearColor(0,0,0,1);
glClear(GL_COLOR_BUFFER_BIT);
}
void Painter::setCompositionMode(Painter::CompositionMode compositionMode)
{
if(m_compositionMode == compositionMode)

@ -65,6 +65,7 @@ public:
void saveState();
void saveAndResetState();
void restoreSavedState();
void clearScreen();
virtual void drawCoords(CoordsBuffer& coordsBuffer, DrawMode drawMode = Triangles) = 0;
virtual void drawTextureCoords(CoordsBuffer& coordsBuffer, const TexturePtr& texture) = 0;

@ -75,13 +75,7 @@ void MapView::draw(const Rect& rect)
if(m_mustCleanFramebuffer) {
Rect clearRect = Rect(0, 0, m_drawDimension * m_tileSize);
// drawing a black rect is actually faster than FrameBuffer::clear()
g_painter->setColor(Color::black);
g_painter->drawFilledRect(clearRect);
g_painter->setColor(Color::white);
//m_framebuffer->clear(Color::black);
m_framebuffer->clear(Color::black, clearRect);
}
auto it = m_cachedVisibleTiles.begin();

Loading…
Cancel
Save