From 92b54b6f55b21a11212736e2b0d06d8fca0e49fa Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Sun, 14 Aug 2011 15:13:33 -0300 Subject: [PATCH] fix map render --- src/framework/graphics/graphics.cpp | 13 ++++++++----- src/map.cpp | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/framework/graphics/graphics.cpp b/src/framework/graphics/graphics.cpp index 61db5863..c44aaa15 100644 --- a/src/framework/graphics/graphics.cpp +++ b/src/framework/graphics/graphics.cpp @@ -200,7 +200,7 @@ void Graphics::drawFilledRect(const Rect& screenCoords, int top = screenCoords.top(); int left = screenCoords.left(); - + glPushAttrib(GL_CURRENT_BIT); glColor4ubv(color.rgbaPtr()); glDisable(GL_TEXTURE_2D); glBegin(GL_QUADS); @@ -212,6 +212,7 @@ void Graphics::drawFilledRect(const Rect& screenCoords, glEnd(); glEnable(GL_TEXTURE_2D); + glPopAttrib(); } @@ -230,6 +231,7 @@ void Graphics::drawBoundingRect(const Rect& screenCoords, int top = screenCoords.top(); int left = screenCoords.left(); + glPushAttrib(GL_CURRENT_BIT); glColor4ubv(color.rgbaPtr()); glDisable(GL_TEXTURE_2D); glBegin(GL_QUADS); @@ -259,6 +261,8 @@ void Graphics::drawBoundingRect(const Rect& screenCoords, glVertex2i(right - innerLineWidth, top + innerLineWidth); glEnd(); + glEnable(GL_TEXTURE_2D); + glPopAttrib(); } void Graphics::bindColor(const Color& color) @@ -282,9 +286,8 @@ void Graphics::startDrawing() void Graphics::stopDrawing() { - if(m_drawing) { - glEnd(); - m_drawing = false; - } + assert(m_drawing); + glEnd(); + m_drawing = false; } diff --git a/src/map.cpp b/src/map.cpp index 2959b168..7917d6a0 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -8,6 +8,7 @@ void Map::draw(int x, int y) if(!m_framebuffer) m_framebuffer = FrameBufferPtr(new FrameBuffer(15*32, 11*32)); + g_graphics.bindColor(Color::white); m_framebuffer->bind(); Position *playerPos = g_game.getPlayer()->getPosition();