begin implementing OpenGL 1.0 engine

* option to pass -opengl1 or -opengl2 as argument
* note that with this commit there are a lot of graphics regressions and the master will remaing unstable for a while
* shaders disabled for a while
This commit is contained in:
Eduardo Bart
2012-04-18 20:03:43 -03:00
parent a4a00a49fe
commit 58d76e255d
46 changed files with 1303 additions and 510 deletions

View File

@@ -105,43 +105,44 @@ void FrameBuffer::clear(const Color& color, const Rect& rect)
{
bool clip = rect.isValid();
if(clip)
g_painter.setClipRect(Rect(0, 0, m_texture->getSize()));
g_painter->setClipRect(Rect(0, 0, m_texture->getSize()));
glClearColor(color.rF(), color.gF(), color.bF(), color.aF());
glClear(GL_COLOR_BUFFER_BIT);
if(clip)
g_painter.resetClipRect();
g_painter->resetClipRect();
}
void FrameBuffer::bind()
{
internalBind();
Matrix3 projectionMatrix = { 2.0f/m_texture->getWidth(), 0.0f, 0.0f,
0.0f, 2.0f/m_texture->getHeight(), 0.0f,
-1.0f, -1.0f, 0.0f };
-1.0f, -1.0f, 1.0f };
g_painter->saveAndResetState();
g_painter->setProjectionMatrix(projectionMatrix);
m_oldProjectionMatrix = g_painter.getProjectionMatrix();
m_oldViewportSize = g_graphics.getViewportSize();
g_painter.setProjectionMatrix(projectionMatrix);
g_graphics.setViewportSize(m_texture->getSize());
}
void FrameBuffer::release()
{
internalRelease();
g_painter.setProjectionMatrix(m_oldProjectionMatrix);
g_painter->restoreSavedState();
g_graphics.setViewportSize(m_oldViewportSize);
}
void FrameBuffer::draw(const Rect& dest, const Rect& src)
{
g_painter.drawTexturedRect(dest, m_texture, src);
g_painter->drawTexturedRect(dest, m_texture, src);
}
void FrameBuffer::draw(const Rect& dest)
{
g_painter.drawTexturedRect(dest, m_texture, Rect(0,0, getSize()));
g_painter->drawTexturedRect(dest, m_texture, Rect(0,0, getSize()));
}
void FrameBuffer::internalBind()