diff options
author | Alejandro Marzini | 2010-07-15 04:01:41 +0000 |
---|---|---|
committer | Alejandro Marzini | 2010-07-15 04:01:41 +0000 |
commit | 9ef2fc4744f88837c63150b09655ae3e51023b7e (patch) | |
tree | 0da80d52789b9cc4251c5df3e8bbb5b0707d44f5 /backends/graphics/opengl/opengl-graphics.cpp | |
parent | d677ba5a1146ae48c0831e1056350d3efa2e43fd (diff) | |
download | scummvm-rg350-9ef2fc4744f88837c63150b09655ae3e51023b7e.tar.gz scummvm-rg350-9ef2fc4744f88837c63150b09655ae3e51023b7e.tar.bz2 scummvm-rg350-9ef2fc4744f88837c63150b09655ae3e51023b7e.zip |
Fixed doing OpenGL calls before a graphical context was created.
svn-id: r50905
Diffstat (limited to 'backends/graphics/opengl/opengl-graphics.cpp')
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.cpp | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index f5f0cdeb57..49589ead30 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -53,26 +53,6 @@ OpenGLGraphicsManager::~OpenGLGraphicsManager() { } -void OpenGLGraphicsManager::init() { - GLTexture::initGLExtensions(); - - glDisable(GL_CULL_FACE); - glDisable(GL_DEPTH_TEST); - glDisable(GL_LIGHTING); - glDisable(GL_FOG); - glDisable(GL_DITHER); - glShadeModel(GL_FLAT); - glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - - glEnable(GL_TEXTURE_2D); -} - // // Feature // @@ -463,6 +443,32 @@ void OpenGLGraphicsManager::internUpdateScreen() { } bool OpenGLGraphicsManager::loadGFXMode() { + GLTexture::initGLExtensions(); + + glDisable(GL_CULL_FACE); + glDisable(GL_DEPTH_TEST); + glDisable(GL_LIGHTING); + glDisable(GL_FOG); + glDisable(GL_DITHER); + glShadeModel(GL_FLAT); + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + + glEnable(GL_TEXTURE_2D); + + glViewport(0, 0, _videoMode.hardwareWidth, _videoMode.hardwareHeight); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, _videoMode.hardwareWidth, _videoMode.hardwareHeight, 0, -1, 1); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + if (!_gameTexture) { byte bpp; GLenum format; @@ -485,14 +491,6 @@ bool OpenGLGraphicsManager::loadGFXMode() { _gameTexture->allocBuffer(_videoMode.screenWidth, _videoMode.screenHeight); _overlayTexture->allocBuffer(_videoMode.overlayWidth, _videoMode.overlayHeight); - glViewport(0, 0, _videoMode.hardwareWidth, _videoMode.hardwareHeight); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, _videoMode.hardwareWidth, _videoMode.hardwareHeight, 0, -1, 1); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - return true; } |