aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Marzini2010-07-15 04:01:41 +0000
committerAlejandro Marzini2010-07-15 04:01:41 +0000
commit9ef2fc4744f88837c63150b09655ae3e51023b7e (patch)
tree0da80d52789b9cc4251c5df3e8bbb5b0707d44f5
parentd677ba5a1146ae48c0831e1056350d3efa2e43fd (diff)
downloadscummvm-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
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp54
-rw-r--r--backends/graphics/opengl/opengl-graphics.h2
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.cpp11
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.h2
-rw-r--r--backends/graphics/sdl/sdl-graphics.cpp3
-rw-r--r--backends/platform/sdl/sdl.cpp1
6 files changed, 31 insertions, 42 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;
}
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index e0807d8a73..70a7bc0960 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -47,8 +47,6 @@ public:
OpenGLGraphicsManager();
virtual ~OpenGLGraphicsManager();
- virtual void init();
-
virtual bool hasFeature(OSystem::Feature f);
virtual void setFeatureState(OSystem::Feature f, bool enable);
virtual bool getFeatureState(OSystem::Feature f);
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index ceaa20c425..aaa7ac7dd0 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -31,20 +31,15 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager()
:
_hwscreen(0) {
-}
-
-OpenGLSdlGraphicsManager::~OpenGLSdlGraphicsManager() {
-
-}
-
-void OpenGLSdlGraphicsManager::init() {
if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1) {
error("Could not initialize SDL: %s", SDL_GetError());
}
SDL_ShowCursor(SDL_DISABLE);
+}
+
+OpenGLSdlGraphicsManager::~OpenGLSdlGraphicsManager() {
- OpenGLGraphicsManager::init();
}
#ifdef USE_RGB_COLOR
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.h b/backends/graphics/openglsdl/openglsdl-graphics.h
index c678f3f0ca..f1f0d5ff37 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.h
+++ b/backends/graphics/openglsdl/openglsdl-graphics.h
@@ -42,8 +42,6 @@ public:
OpenGLSdlGraphicsManager();
virtual ~OpenGLSdlGraphicsManager();
- virtual void init();
-
#ifdef USE_RGB_COLOR
virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const;
#endif
diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp
index 8b42f837ca..efb8e9afc8 100644
--- a/backends/graphics/sdl/sdl-graphics.cpp
+++ b/backends/graphics/sdl/sdl-graphics.cpp
@@ -921,7 +921,8 @@ void SdlGraphicsManager::internUpdateScreen() {
ScalerProc *scalerProc;
int scale1;
-#if defined (DEBUG) && ! defined(_WIN32_WCE) // definitions not available for non-DEBUG here. (needed this to compile in SYMBIAN32 & linux?)
+ // definitions not available for non-DEBUG here. (needed this to compile in SYMBIAN32 & linux?)
+#if defined (DEBUG) && !defined(WIN32) && !defined(_WIN32_WCE)
assert(_hwscreen != NULL);
assert(_hwscreen->map->sw_data != NULL);
#endif
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 58e4167a7c..781cff46cb 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -107,7 +107,6 @@ void OSystem_SDL::initBackend() {
}
}*/
_graphicsManager = new OpenGLSdlGraphicsManager();
- ((OpenGLSdlGraphicsManager *)_graphicsManager)->init();
#endif
if (_graphicsManager == 0)
_graphicsManager = new SdlGraphicsManager();