[Add] More FSAA awareness.
This commit is contained in:
parent
a6fe5f8a2d
commit
8038ce5dc3
22
src/opengl.c
22
src/opengl.c
@ -857,7 +857,7 @@ void gl_checkErr(void) {
|
||||
|
||||
/* Initialize SDL/OpenGL etc. */
|
||||
int gl_init(void) {
|
||||
int doublebuf, depth, i, j, off, toff, supported;
|
||||
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);
|
||||
@ -946,7 +946,7 @@ int gl_init(void) {
|
||||
/* Actually creating the screen. */
|
||||
if(SDL_SetVideoMode(SCREEN_W, SCREEN_H, gl_screen.depth, flags) == NULL) {
|
||||
if(gl_has(OPENGL_FSAA)) {
|
||||
LOG("Disablin FSAA.");
|
||||
LOG("Unable to create OpenGL window: Trying without FSAA.");
|
||||
gl_screen.flags &= ~OPENGL_FSAA;
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
|
||||
@ -958,11 +958,12 @@ int gl_init(void) {
|
||||
}
|
||||
|
||||
/* Grab some info. */
|
||||
SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &gl_screen.r);
|
||||
SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &gl_screen.g);
|
||||
SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &gl_screen.b);
|
||||
SDL_GL_GetAttribute(SDL_GL_ALPHA_SIZE, &gl_screen.a);
|
||||
SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &doublebuf);
|
||||
SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &gl_screen.r);
|
||||
SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &gl_screen.g);
|
||||
SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &gl_screen.b);
|
||||
SDL_GL_GetAttribute(SDL_GL_ALPHA_SIZE, &gl_screen.a);
|
||||
SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &doublebuf);
|
||||
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &fsaa);
|
||||
if(doublebuf) gl_screen.flags |= OPENGL_DOUBLEBUF;
|
||||
gl_screen.depth = gl_screen.r + gl_screen.g + gl_screen.b + gl_screen.a;
|
||||
|
||||
@ -980,10 +981,10 @@ int gl_init(void) {
|
||||
DEBUG("OpenGL Window Created: %dx%d@%dbpp %s", SCREEN_W, SCREEN_H,
|
||||
gl_screen.depth, (gl_has(OPENGL_FULLSCREEN)) ? "fullscreen" : "window");
|
||||
|
||||
DEBUG("r: %d, g: %d, b: %d, a: %d, db: %s, tex: %d",
|
||||
DEBUG("r: %d, g: %d, b: %d, a: %d, db: %s, fsaa: %d, tex: %d",
|
||||
gl_screen.r, gl_screen.g, gl_screen.b, gl_screen.a,
|
||||
gl_has(OPENGL_DOUBLEBUF) ? "yes" : "no",
|
||||
gl_screen.tex_max);
|
||||
fsaa, gl_screen.tex_max);
|
||||
|
||||
DEBUG("Renderer: %s", glGetString(GL_RENDERER));
|
||||
DEBUG("Version: %s", glGetString(GL_VERSION));
|
||||
@ -991,6 +992,9 @@ int gl_init(void) {
|
||||
if(gl_screen.multitex_max < OPENGL_REQ_MULTITEX)
|
||||
WARN("Missing texture units (%d required, %d found)",
|
||||
OPENGL_REQ_MULTITEX, gl_screen.multitex_max);
|
||||
if(gl_has(OPENGL_FSAA) && (fsaa != gl_screen.fsaa))
|
||||
WARN("Unable to get requested fsaa level (%d requested, got %d)",
|
||||
gl_screen.fsaa, fsaa);
|
||||
if(!gl_has(OPENGL_FRAG_SHADER))
|
||||
DEBUG("No fragment shader extension detected"); /* Not a warning yet. */
|
||||
DEBUG("");
|
||||
|
@ -48,7 +48,7 @@ typedef struct glInfo_ {
|
||||
int flags; /**< Store different properties. */
|
||||
int tex_max; /**< Max texture size. */
|
||||
int multitex_max; /**< Max multitexture levels. */
|
||||
int fsaa; /**< Full scene Anti-Aliasing level. */
|
||||
int fsaa; /**< Full screen Anti-Aliasing level. */
|
||||
} glInfo;
|
||||
extern glInfo gl_screen; /* Local structure set with gl_init etc. */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user