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