[Change] Never try to create a screen aboe the players resolution unless
she forces it to.
This commit is contained in:
parent
0da68c2c36
commit
d0d02502ea
21
src/opengl.c
21
src/opengl.c
@ -1040,10 +1040,12 @@ void gl_checkErr(void) {
|
||||
int gl_init(void) {
|
||||
int doublebuf, depth, i, j, off, toff, supported, fsaa;
|
||||
SDL_Rect** modes;
|
||||
int flags = SDL_OPENGL;
|
||||
flags |= SDL_FULLSCREEN * (gl_has(OPENGL_FULLSCREEN) ? 1: 0);
|
||||
int flags;
|
||||
|
||||
/* Defaults. */
|
||||
supported = 0;
|
||||
flags = SDL_OPENGL;
|
||||
flags |= SDL_FULLSCREEN * (gl_has(OPENGL_FULLSCREEN) ? 1 : 0);
|
||||
|
||||
/* Initializes video. */
|
||||
if(SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) {
|
||||
@ -1051,6 +1053,9 @@ int gl_init(void) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Get the video information. */
|
||||
const SDL_VideoInfo* vidinfo = SDL_GetVideoInfo();
|
||||
|
||||
/* Set opengl flags. */
|
||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); /* Ideally want double buffering. */
|
||||
if(gl_has(OPENGL_FSAA)) {
|
||||
@ -1064,7 +1069,6 @@ int gl_init(void) {
|
||||
/* Try to use desktop resolution if nothing is specifically set. */
|
||||
#if SDL_VERSION_ATLEAST(1,2,10)
|
||||
if(!gl_has(OPENGL_DIM_DEF)) {
|
||||
const SDL_VideoInfo* vidinfo = SDL_GetVideoInfo();
|
||||
gl_screen.w = vidinfo->current_w;
|
||||
gl_screen.h = vidinfo->current_h;
|
||||
}
|
||||
@ -1112,6 +1116,17 @@ int gl_init(void) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check to see if trying to create above screen resolution without player
|
||||
* asking for such a large size.
|
||||
*/
|
||||
#if SDL_VERSION_ATLEAST(1, 2, 10)
|
||||
if(!gl_has(OPENGL_DIM_DEF)) {
|
||||
gl_screen.w = MIN(gl_screen.w, vidinfo->current_w);
|
||||
gl_screen.h = MIN(gl_screen.h, vidinfo->current_h);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Test the setup - aim for 32. */
|
||||
gl_screen.depth = 32;
|
||||
depth = SDL_VideoModeOK(SCREEN_W, SCREEN_H, gl_screen.depth, flags);
|
||||
|
Loading…
Reference in New Issue
Block a user