diff --git a/src/Platform/Sdl2Application.cpp b/src/Platform/Sdl2Application.cpp index 9a39d9251..881ec5aab 100644 --- a/src/Platform/Sdl2Application.cpp +++ b/src/Platform/Sdl2Application.cpp @@ -69,6 +69,12 @@ void Sdl2Application::createContext(Configuration* configuration) { SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); + /* Multisampling */ + if(configuration->sampleCount()) { + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, configuration->sampleCount()); + } + window = SDL_CreateWindow(configuration->title().c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, configuration->size().x(), configuration->size().y(), SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN); if(!window) { diff --git a/src/Platform/Sdl2Application.h b/src/Platform/Sdl2Application.h index 9f36b90c4..860feda8f 100644 --- a/src/Platform/Sdl2Application.h +++ b/src/Platform/Sdl2Application.h @@ -219,9 +219,25 @@ class Sdl2Application::Configuration { return this; } + /** @brief Sample count */ + inline Int sampleCount() const { return _sampleCount; } + + /** + * @brief Set sample count + * @return Pointer to self (for method chaining) + * + * Default is `0`, thus no multisampling. See also + * @ref Renderer::Feature "Renderer::Feature::Multisampling". + */ + inline Configuration* setSampleCount(Int count) { + _sampleCount = count; + return this; + } + private: std::string _title; Vector2i _size; + Int _sampleCount; }; /**