Fix some graphics issues with old drivers

This commit is contained in:
Eduardo Bart 2012-08-19 22:38:43 -03:00
parent b349ff2620
commit f4cc942c85
1 changed files with 25 additions and 10 deletions

View File

@ -87,6 +87,9 @@ void Graphics::init()
if(m_maxTextureSize == -1 || m_maxTextureSize > maxTextureSize) if(m_maxTextureSize == -1 || m_maxTextureSize > maxTextureSize)
m_maxTextureSize = maxTextureSize; m_maxTextureSize = maxTextureSize;
if(Size(m_maxTextureSize,m_maxTextureSize) < g_window.getDisplaySize())
m_cacheBackbuffer = false;
m_alphaBits = 0; m_alphaBits = 0;
glGetIntegerv(GL_ALPHA_BITS, &m_alphaBits); glGetIntegerv(GL_ALPHA_BITS, &m_alphaBits);
@ -169,28 +172,40 @@ bool Graphics::isPainterEngineAvailable(Graphics::PainterEngine painterEngine)
bool Graphics::selectPainterEngine(PainterEngine painterEngine) bool Graphics::selectPainterEngine(PainterEngine painterEngine)
{ {
Painter *painter = nullptr; Painter *painter = nullptr;
Painter *fallbackPainter = nullptr;
#ifdef PAINTER_OGL2 #ifdef PAINTER_OGL2
// always prefer OpenGL 2 over OpenGL 1 // always prefer OpenGL 2 over OpenGL 1
if(!painter && g_painterOGL2 && (painterEngine == Painter_OpenGL2 || painterEngine == Painter_Any)) { if(g_painterOGL2) {
if(!painter && (painterEngine == Painter_OpenGL2 || painterEngine == Painter_Any)) {
m_selectedPainterEngine = Painter_OpenGL2; m_selectedPainterEngine = Painter_OpenGL2;
painter = g_painterOGL2; painter = g_painterOGL2;
} }
fallbackPainter = g_painterOGL2;
}
#endif #endif
#ifdef PAINTER_OGL1 #ifdef PAINTER_OGL1
// fallback to OpenGL 1 in older hardwares // fallback to OpenGL 1 in older hardwares
if(!painter && g_painterOGL1 && (painterEngine == Painter_OpenGL1 || painterEngine == Painter_Any)) { if(g_painterOGL1) {
if(!painter && (painterEngine == Painter_OpenGL1 || painterEngine == Painter_Any)) {
m_selectedPainterEngine = Painter_OpenGL1; m_selectedPainterEngine = Painter_OpenGL1;
painter = g_painterOGL1; painter = g_painterOGL1;
} }
fallbackPainter = g_painterOGL1;
}
#endif #endif
if(!painter)
painter = fallbackPainter;
// switch painters GL state // switch painters GL state
if(painter) { if(painter) {
if(painter != g_painter) {
if(g_painter) if(g_painter)
g_painter->unbind(); g_painter->unbind();
painter->bind(); painter->bind();
g_painter = painter; g_painter = painter;
}
if(painterEngine == Painter_Any) if(painterEngine == Painter_Any)
return true; return true;