Fixed doing OpenGL calls before a graphical context was created.
svn-id: r50905
This commit is contained in:
parent
d677ba5a11
commit
9ef2fc4744
6 changed files with 31 additions and 42 deletions
|
@ -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
|
// Feature
|
||||||
//
|
//
|
||||||
|
@ -463,6 +443,32 @@ void OpenGLGraphicsManager::internUpdateScreen() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenGLGraphicsManager::loadGFXMode() {
|
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) {
|
if (!_gameTexture) {
|
||||||
byte bpp;
|
byte bpp;
|
||||||
GLenum format;
|
GLenum format;
|
||||||
|
@ -485,14 +491,6 @@ bool OpenGLGraphicsManager::loadGFXMode() {
|
||||||
_gameTexture->allocBuffer(_videoMode.screenWidth, _videoMode.screenHeight);
|
_gameTexture->allocBuffer(_videoMode.screenWidth, _videoMode.screenHeight);
|
||||||
_overlayTexture->allocBuffer(_videoMode.overlayWidth, _videoMode.overlayHeight);
|
_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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,6 @@ public:
|
||||||
OpenGLGraphicsManager();
|
OpenGLGraphicsManager();
|
||||||
virtual ~OpenGLGraphicsManager();
|
virtual ~OpenGLGraphicsManager();
|
||||||
|
|
||||||
virtual void init();
|
|
||||||
|
|
||||||
virtual bool hasFeature(OSystem::Feature f);
|
virtual bool hasFeature(OSystem::Feature f);
|
||||||
virtual void setFeatureState(OSystem::Feature f, bool enable);
|
virtual void setFeatureState(OSystem::Feature f, bool enable);
|
||||||
virtual bool getFeatureState(OSystem::Feature f);
|
virtual bool getFeatureState(OSystem::Feature f);
|
||||||
|
|
|
@ -31,20 +31,15 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager()
|
||||||
:
|
:
|
||||||
_hwscreen(0) {
|
_hwscreen(0) {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
OpenGLSdlGraphicsManager::~OpenGLSdlGraphicsManager() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void OpenGLSdlGraphicsManager::init() {
|
|
||||||
if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1) {
|
if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1) {
|
||||||
error("Could not initialize SDL: %s", SDL_GetError());
|
error("Could not initialize SDL: %s", SDL_GetError());
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_ShowCursor(SDL_DISABLE);
|
SDL_ShowCursor(SDL_DISABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenGLSdlGraphicsManager::~OpenGLSdlGraphicsManager() {
|
||||||
|
|
||||||
OpenGLGraphicsManager::init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_RGB_COLOR
|
#ifdef USE_RGB_COLOR
|
||||||
|
|
|
@ -42,8 +42,6 @@ public:
|
||||||
OpenGLSdlGraphicsManager();
|
OpenGLSdlGraphicsManager();
|
||||||
virtual ~OpenGLSdlGraphicsManager();
|
virtual ~OpenGLSdlGraphicsManager();
|
||||||
|
|
||||||
virtual void init();
|
|
||||||
|
|
||||||
#ifdef USE_RGB_COLOR
|
#ifdef USE_RGB_COLOR
|
||||||
virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const;
|
virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -921,7 +921,8 @@ void SdlGraphicsManager::internUpdateScreen() {
|
||||||
ScalerProc *scalerProc;
|
ScalerProc *scalerProc;
|
||||||
int scale1;
|
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 != NULL);
|
||||||
assert(_hwscreen->map->sw_data != NULL);
|
assert(_hwscreen->map->sw_data != NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -107,7 +107,6 @@ void OSystem_SDL::initBackend() {
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
_graphicsManager = new OpenGLSdlGraphicsManager();
|
_graphicsManager = new OpenGLSdlGraphicsManager();
|
||||||
((OpenGLSdlGraphicsManager *)_graphicsManager)->init();
|
|
||||||
#endif
|
#endif
|
||||||
if (_graphicsManager == 0)
|
if (_graphicsManager == 0)
|
||||||
_graphicsManager = new SdlGraphicsManager();
|
_graphicsManager = new SdlGraphicsManager();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue