X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Finit.cpp;fp=src%2Finit.cpp;h=73a73094749ec1e6d6712f5dc2a7296816ee6f96;hb=f90ec88e6728ce865bcf892c810a36abd90d9001;hp=061e848e073691af5fcedca51763e4af97c91a80;hpb=32a2a1231de8438f8408007c41247361b1c52417;p=blank.git diff --git a/src/init.cpp b/src/init.cpp index 061e848..73a7309 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -46,7 +46,7 @@ InitIMG::~InitIMG() { } -InitGL::InitGL() { +InitGL::InitGL(bool double_buffer, int sample_size) { if (SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3) != 0) { sdl_error("SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3)"); } @@ -57,8 +57,19 @@ InitGL::InitGL() { sdl_error("SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE)"); } - if (SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1) != 0) { - sdl_error("SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1)"); + if (double_buffer) { + if (SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1) != 0) { + sdl_error("SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1)"); + } + } + + if (sample_size > 1) { + if (SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1) != 0) { + sdl_error("SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS)"); + } + if (SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, sample_size) != 0) { + sdl_error("SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES)"); + } } }