fix framebuffer
This commit is contained in:
parent
f78d1c91b0
commit
7cf188a67d
|
@ -78,6 +78,9 @@ FrameBuffer::FrameBuffer(int width, int height)
|
||||||
m_fallbackOldImp = true;
|
m_fallbackOldImp = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// restore back buffer
|
||||||
|
oglBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
|
||||||
} else {
|
} else {
|
||||||
// otherwise fallback to copy texture from screen implementation
|
// otherwise fallback to copy texture from screen implementation
|
||||||
m_fallbackOldImp = true;
|
m_fallbackOldImp = true;
|
||||||
|
@ -147,6 +150,8 @@ void FrameBuffer::draw(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
g_graphics.disableDrawing();
|
g_graphics.disableDrawing();
|
||||||
|
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
glColor4ubv(Color::white.rgbaPtr());
|
||||||
glBindTexture(GL_TEXTURE_2D, m_fboTexture);
|
glBindTexture(GL_TEXTURE_2D, m_fboTexture);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2i(0, 0); glVertex2i(x, y);
|
glTexCoord2i(0, 0); glVertex2i(x, y);
|
||||||
|
|
|
@ -33,7 +33,6 @@ void Graphics::init()
|
||||||
glEnable(GL_ALPHA_TEST); // enable alpha by default
|
glEnable(GL_ALPHA_TEST); // enable alpha by default
|
||||||
glAlphaFunc(GL_GREATER, 0.0f); // default alpha mode
|
glAlphaFunc(GL_GREATER, 0.0f); // default alpha mode
|
||||||
glDisable(GL_DEPTH_TEST); // we are rendering 2D only, we don't need it
|
glDisable(GL_DEPTH_TEST); // we are rendering 2D only, we don't need it
|
||||||
glEnable(GL_TEXTURE_2D); // enable textures by default
|
|
||||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
||||||
glShadeModel(GL_SMOOTH);
|
glShadeModel(GL_SMOOTH);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
@ -127,6 +126,9 @@ void Graphics::disableDrawing()
|
||||||
if(m_drawMode != DRAW_NONE) {
|
if(m_drawMode != DRAW_NONE) {
|
||||||
glEnd();
|
glEnd();
|
||||||
m_drawMode = DRAW_NONE;
|
m_drawMode = DRAW_NONE;
|
||||||
|
|
||||||
|
m_bindedTexture.reset();
|
||||||
|
glColor4ubv(Color::white.rgbaPtr());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
#include <graphics/graphics.h>
|
||||||
|
|
||||||
void Map::draw(int x, int y)
|
void Map::draw(int x, int y)
|
||||||
{
|
{
|
||||||
|
@ -18,9 +19,9 @@ void Map::draw(int x, int y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_framebuffer->unbind();
|
m_framebuffer->unbind();
|
||||||
m_framebuffer->draw(0, 0, width, heigth);
|
|
||||||
|
m_framebuffer->draw(0, 0, g_graphics.getScreenSize().width(), g_graphics.getScreenSize().height());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Map::addThing(Thing *thing, const Position& pos)
|
void Map::addThing(Thing *thing, const Position& pos)
|
||||||
|
|
Loading…
Reference in New Issue