diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index 68cb95668..4c87bde0c 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -127,6 +127,9 @@ bool Graphics::setMode(int width, int height, bool fullscreen, bool vsync, int f initializeContext(); + // Make sure antialiasing works when set elsewhere + glEnable(GL_MULTISAMPLE); + // Enable blending glEnable(GL_BLEND); @@ -138,6 +141,10 @@ bool Graphics::setMode(int width, int height, bool fullscreen, bool vsync, int f glEnable(GL_POINT_SMOOTH); glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); + // Auto-generated mipmaps should be the best quality possible + if (GLEE_VERSION_1_4 || GLEE_SGIS_generate_mipmap) + glHint(GL_GENERATE_MIPMAP_HINT, GL_NICEST); + // Enable textures glEnable(GL_TEXTURE_2D); setActiveTextureUnit(0); diff --git a/src/modules/graphics/opengl/wrap_Graphics.cpp b/src/modules/graphics/opengl/wrap_Graphics.cpp index f200d9c96..de249a90c 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.cpp +++ b/src/modules/graphics/opengl/wrap_Graphics.cpp @@ -1391,7 +1391,7 @@ extern "C" int luaopen_love_graphics(lua_State *L) { instance = new Graphics(); } - catch(Exception &e) + catch (love::Exception &e) { return luaL_error(L, e.what()); } diff --git a/src/modules/window/sdl/Window.cpp b/src/modules/window/sdl/Window.cpp index 3d4691f13..b097b5b04 100644 --- a/src/modules/window/sdl/Window.cpp +++ b/src/modules/window/sdl/Window.cpp @@ -24,9 +24,6 @@ // SDL #include -// OpenGL -#include - // LOVE #include "common/config.h" #include "Window.h" @@ -41,13 +38,12 @@ namespace sdl Window::Window() : windowTitle("") , created(false) - , mouseVisible(true) { // Window should be centered. SDL_putenv(const_cast("SDL_VIDEO_CENTERED=center")); if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) - throw Exception(SDL_GetError()); + throw love::Exception(SDL_GetError()); } Window::~Window() @@ -101,11 +97,8 @@ bool Window::setWindow(int width, int height, bool fullscreen, bool vsync, int f SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1); // FSAA - if (fsaa > 0) - { - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, fsaa); - } + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, (fsaa > 0) ? 1 : 0); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, (fsaa > 0) ? fsaa : 0); // Fullscreen? Uint32 sdlflags = fullscreen ? (SDL_OPENGL | SDL_FULLSCREEN) : SDL_OPENGL; @@ -116,15 +109,10 @@ bool Window::setWindow(int width, int height, bool fullscreen, bool vsync, int f bool failed = true; if (fsaa > 0) { - // FSAA might have failed, disable it and try again + // FSAA might have caused the failure, disable it and try again SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0); failed = SDL_SetVideoMode(width, height, 32, sdlflags) == 0; - if (failed) - { - // There might be no FSAA at all - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0); - failed = SDL_SetVideoMode(width, height, 32, sdlflags) == 0; - } } if (failed) { @@ -142,20 +130,17 @@ bool Window::setWindow(int width, int height, bool fullscreen, bool vsync, int f height = videoinfo->current_h; } - if (fsaa > 0) - glEnable(GL_MULTISAMPLE); + int buffers; + int samples; - GLint buffers; - GLint samples; - - glGetIntegerv(GL_SAMPLE_BUFFERS_ARB, &buffers); - glGetIntegerv(GL_SAMPLES_ARB, &samples); + SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &buffers); + SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &samples); // Don't fail because of this, but issue a warning. if ((!buffers && fsaa) || (samples != fsaa)) { - std::cerr << "Warning, quality setting failed! (Result: buffers: " << buffers << ", samples: " << samples << ")" << std::endl; - fsaa = !buffers ? 0 : samples; + std::cerr << "Warning, FSAA setting failed! (Result: buffers: " << buffers << ", samples: " << samples << ")" << std::endl; + fsaa = (buffers > 0) ? samples : 0; } // Get the actual vsync status diff --git a/src/modules/window/sdl/Window.h b/src/modules/window/sdl/Window.h index 52bb9279b..d8d0a85c2 100644 --- a/src/modules/window/sdl/Window.h +++ b/src/modules/window/sdl/Window.h @@ -74,7 +74,6 @@ private: int fsaa; } currentMode; bool created; - bool mouseVisible; }; // Window } // sdl