X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Finit.cpp;h=73a73094749ec1e6d6712f5dc2a7296816ee6f96;hb=e74f1ad236429f05db90c0ace825277e2a3fbc05;hp=2c1c73ad6155e0aae9654f9fa9a58f6c93477fe2;hpb=6af76d9e1a6499ebdab405c1d679d24b9e19fded;p=blank.git diff --git a/src/init.cpp b/src/init.cpp index 2c1c73a..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)"); + } } } @@ -151,6 +162,10 @@ void GLContext::Clear() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } +void GLContext::ClearDepthBuffer() { + glClear(GL_DEPTH_BUFFER_BIT); +} + InitGLEW::InitGLEW() { glewExperimental = GL_TRUE;