mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-01 06:14:07 +00:00
Fixed doing OpenGL calls before a graphical context was created.
svn-id: r50905
This commit is contained in:
parent
d677ba5a11
commit
9ef2fc4744
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -42,8 +42,6 @@ public:
|
||||
OpenGLSdlGraphicsManager();
|
||||
virtual ~OpenGLSdlGraphicsManager();
|
||||
|
||||
virtual void init();
|
||||
|
||||
#ifdef USE_RGB_COLOR
|
||||
virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const;
|
||||
#endif
|
||||
|
@ -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
|
||||
|
@ -107,7 +107,6 @@ void OSystem_SDL::initBackend() {
|
||||
}
|
||||
}*/
|
||||
_graphicsManager = new OpenGLSdlGraphicsManager();
|
||||
((OpenGLSdlGraphicsManager *)_graphicsManager)->init();
|
||||
#endif
|
||||
if (_graphicsManager == 0)
|
||||
_graphicsManager = new SdlGraphicsManager();
|
||||
|
Loading…
x
Reference in New Issue
Block a user