diff --git a/lime/graphics/Renderer.hx b/lime/graphics/Renderer.hx index d87398a53..4a9153a72 100644 --- a/lime/graphics/Renderer.hx +++ b/lime/graphics/Renderer.hx @@ -58,13 +58,16 @@ class Renderer { #else - var webgl:RenderingContext = cast window.canvas.getContext ("webgl"); + var options = { + alpha: true, + antialias: window.config.antialiasing > 0, + depth: window.config.depthBuffer, + premultipliedAlpha: true, + stencil: window.config.stencilBuffer, + preserveDrawingBuffer: false + }; - if (webgl == null) { - - webgl = cast window.canvas.getContext ("experimental-webgl"); - - } + var webgl:RenderingContext = cast window.canvas.getContextWebGL(options); #end diff --git a/project/src/backend/sdl/SDLRenderer.cpp b/project/src/backend/sdl/SDLRenderer.cpp index dc03ab4bc..812265994 100644 --- a/project/src/backend/sdl/SDLRenderer.cpp +++ b/project/src/backend/sdl/SDLRenderer.cpp @@ -15,18 +15,6 @@ namespace lime { if (window->flags & WINDOW_FLAG_VSYNC) sdlFlags |= SDL_RENDERER_PRESENTVSYNC; - if (window->flags & WINDOW_FLAG_DEPTH_BUFFER) { - - SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 32 - (window->flags & WINDOW_FLAG_STENCIL_BUFFER) ? 8 : 0); - - } - - if (window->flags & WINDOW_FLAG_STENCIL_BUFFER) { - - SDL_GL_SetAttribute (SDL_GL_STENCIL_SIZE, 8); - - } - sdlRenderer = SDL_CreateRenderer (sdlWindow, -1, sdlFlags); OpenGLBindings::Init (); diff --git a/project/src/backend/sdl/SDLWindow.cpp b/project/src/backend/sdl/SDLWindow.cpp index 48ac271b5..33d7cf95e 100644 --- a/project/src/backend/sdl/SDLWindow.cpp +++ b/project/src/backend/sdl/SDLWindow.cpp @@ -15,6 +15,18 @@ namespace lime { if (flags & WINDOW_FLAG_RESIZABLE) sdlFlags |= SDL_WINDOW_RESIZABLE; if (flags & WINDOW_FLAG_BORDERLESS) sdlFlags |= SDL_WINDOW_BORDERLESS; + if (flags & WINDOW_FLAG_DEPTH_BUFFER) { + + SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 32 - (flags & WINDOW_FLAG_STENCIL_BUFFER) ? 8 : 0); + + } + + if (flags & WINDOW_FLAG_STENCIL_BUFFER) { + + SDL_GL_SetAttribute (SDL_GL_STENCIL_SIZE, 8); + + } + sdlWindow = SDL_CreateWindow (title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, sdlFlags); }