Turn off multisampling by default

This commit is contained in:
Nikita Lisitsa 2020-09-13 11:14:07 +03:00
parent c490d5307e
commit 835e0eab70
2 changed files with 14 additions and 1 deletions

View file

@ -13,6 +13,7 @@ namespace psemek::app
: scene
{
app(std::string const & name);
app(std::string const & name, int multisampling);
~app() override;
virtual bool running() const;

View file

@ -68,6 +68,10 @@ namespace psemek::app
};
app::app(std::string const & name)
: app(name, 0)
{}
app::app(std::string const & name, int multisampling)
: pimpl_{std::make_unique<struct impl>(this)}
{
impl().start_time = clock::now();
@ -81,7 +85,15 @@ namespace psemek::app
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
if (multisampling == 0)
{
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
}
else
{
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, multisampling);
}
impl().window = SDL_CreateWindow(name.data(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 800, 600, SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL | SDL_WINDOW_MAXIMIZED);
if (!impl().window)