fix initialization opengl glitch

This commit is contained in:
Eduardo Bart 2012-06-03 17:25:12 -03:00
parent 75f8b255ec
commit 576e775494
5 changed files with 9 additions and 11 deletions

View File

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

View File

@ -86,10 +86,6 @@ void Graphics::init()
glEnable(GL_CULL_FACE); 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 // determine max texture size
GLint maxTextureSize = 0; GLint maxTextureSize = 0;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);

View File

@ -86,6 +86,12 @@ void Painter::restoreSavedState()
setTexture(m_olderStates[m_oldStateIndex].texture); 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) void Painter::setCompositionMode(Painter::CompositionMode compositionMode)
{ {
if(m_compositionMode == compositionMode) if(m_compositionMode == compositionMode)

View File

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

View File

@ -75,13 +75,7 @@ void MapView::draw(const Rect& rect)
if(m_mustCleanFramebuffer) { if(m_mustCleanFramebuffer) {
Rect clearRect = Rect(0, 0, m_drawDimension * m_tileSize); Rect clearRect = Rect(0, 0, m_drawDimension * m_tileSize);
m_framebuffer->clear(Color::black, clearRect);
// 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);
} }
auto it = m_cachedVisibleTiles.begin(); auto it = m_cachedVisibleTiles.begin();