Improve fix for depth buffer initialisation on Linux
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@4933 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
2bf44d9a17
commit
cbc582ad35
@ -105,6 +105,9 @@ MA 02110-1301, USA.
|
|||||||
#else
|
#else
|
||||||
// Changing the flags can trigger texture bugs.
|
// Changing the flags can trigger texture bugs.
|
||||||
surface = SDL_SetVideoMode(8, 8, 32, videoModeFlags);
|
surface = SDL_SetVideoMode(8, 8, 32, videoModeFlags);
|
||||||
|
if (!surface) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -113,7 +116,9 @@ MA 02110-1301, USA.
|
|||||||
updateContext = YES;
|
updateContext = YES;
|
||||||
#endif
|
#endif
|
||||||
surface = SDL_SetVideoMode(firstScreen.width, firstScreen.height, 32, videoModeFlags);
|
surface = SDL_SetVideoMode(firstScreen.width, firstScreen.height, 32, videoModeFlags);
|
||||||
|
if (!surface) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// blank the surface / go to fullscreen
|
// blank the surface / go to fullscreen
|
||||||
[self initialiseGLWithSize: firstScreen];
|
[self initialiseGLWithSize: firstScreen];
|
||||||
}
|
}
|
||||||
@ -228,16 +233,19 @@ MA 02110-1301, USA.
|
|||||||
firstScreen= (fullScreen) ? [self modeAsSize: currentSize] : currentWindowSize;
|
firstScreen= (fullScreen) ? [self modeAsSize: currentSize] : currentWindowSize;
|
||||||
viewSize = firstScreen; // viewSize must be set prior to splash screen initialization
|
viewSize = firstScreen; // viewSize must be set prior to splash screen initialization
|
||||||
|
|
||||||
|
OOLog(@"display.initGL",@"Trying 32-bit depth buffer");
|
||||||
[self createSurface];
|
[self createSurface];
|
||||||
if (surface == NULL)
|
if (surface == NULL)
|
||||||
{
|
{
|
||||||
// Retry with a 24-bit depth buffer
|
// Retry with a 24-bit depth buffer
|
||||||
|
OOLog(@"display.initGL",@"Trying 24-bit depth buffer");
|
||||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
|
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
|
||||||
[self createSurface];
|
[self createSurface];
|
||||||
if (surface == NULL)
|
if (surface == NULL)
|
||||||
{
|
{
|
||||||
// Still not working? One last go...
|
// Still not working? One last go...
|
||||||
// Retry, allowing 16-bit contexts.
|
// Retry, allowing 16-bit contexts.
|
||||||
|
OOLog(@"display.initGL",@"Trying 16-bit depth buffer");
|
||||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
|
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
|
||||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
|
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
|
||||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
|
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
|
||||||
@ -788,9 +796,12 @@ MA 02110-1301, USA.
|
|||||||
videoModeFlags |= SDL_RESIZABLE;
|
videoModeFlags |= SDL_RESIZABLE;
|
||||||
surface = SDL_SetVideoMode((int)viewSize.width, (int)viewSize.height, 32, videoModeFlags);
|
surface = SDL_SetVideoMode((int)viewSize.width, (int)viewSize.height, 32, videoModeFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!surface)
|
if (!surface)
|
||||||
{
|
{
|
||||||
return; // fall back with a NULL surface to a different context
|
// we should always have a valid surface, but in case we don't
|
||||||
|
OOLogERR(@"display.mode.error",@"Unable to change display mode: %s",SDL_GetError());
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bounds.size.width = surface->w;
|
bounds.size.width = surface->w;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user