fix map render

This commit is contained in:
Eduardo Bart 2011-08-14 15:13:33 -03:00
parent 80564b9dff
commit 92b54b6f55
2 changed files with 9 additions and 5 deletions

View File

@ -200,7 +200,7 @@ void Graphics::drawFilledRect(const Rect& screenCoords,
int top = screenCoords.top(); int top = screenCoords.top();
int left = screenCoords.left(); int left = screenCoords.left();
glPushAttrib(GL_CURRENT_BIT);
glColor4ubv(color.rgbaPtr()); glColor4ubv(color.rgbaPtr());
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glBegin(GL_QUADS); glBegin(GL_QUADS);
@ -212,6 +212,7 @@ void Graphics::drawFilledRect(const Rect& screenCoords,
glEnd(); glEnd();
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glPopAttrib();
} }
@ -230,6 +231,7 @@ void Graphics::drawBoundingRect(const Rect& screenCoords,
int top = screenCoords.top(); int top = screenCoords.top();
int left = screenCoords.left(); int left = screenCoords.left();
glPushAttrib(GL_CURRENT_BIT);
glColor4ubv(color.rgbaPtr()); glColor4ubv(color.rgbaPtr());
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glBegin(GL_QUADS); glBegin(GL_QUADS);
@ -259,6 +261,8 @@ void Graphics::drawBoundingRect(const Rect& screenCoords,
glVertex2i(right - innerLineWidth, top + innerLineWidth); glVertex2i(right - innerLineWidth, top + innerLineWidth);
glEnd(); glEnd();
glEnable(GL_TEXTURE_2D);
glPopAttrib();
} }
void Graphics::bindColor(const Color& color) void Graphics::bindColor(const Color& color)
@ -282,9 +286,8 @@ void Graphics::startDrawing()
void Graphics::stopDrawing() void Graphics::stopDrawing()
{ {
if(m_drawing) { assert(m_drawing);
glEnd(); glEnd();
m_drawing = false; m_drawing = false;
}
} }

View File

@ -8,6 +8,7 @@ void Map::draw(int x, int y)
if(!m_framebuffer) if(!m_framebuffer)
m_framebuffer = FrameBufferPtr(new FrameBuffer(15*32, 11*32)); m_framebuffer = FrameBufferPtr(new FrameBuffer(15*32, 11*32));
g_graphics.bindColor(Color::white);
m_framebuffer->bind(); m_framebuffer->bind();
Position *playerPos = g_game.getPlayer()->getPosition(); Position *playerPos = g_game.getPlayer()->getPosition();