Merge pull request #218 from mrcdk/fix_renderer
Fix the webGL and SDL2 renderer's stencil and depth buffers
This commit is contained in:
@@ -58,13 +58,16 @@ class Renderer {
|
|||||||
|
|
||||||
#else
|
#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) {
|
var webgl:RenderingContext = cast window.canvas.getContextWebGL(options);
|
||||||
|
|
||||||
webgl = cast window.canvas.getContext ("experimental-webgl");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
|||||||
@@ -15,18 +15,6 @@ namespace lime {
|
|||||||
|
|
||||||
if (window->flags & WINDOW_FLAG_VSYNC) sdlFlags |= SDL_RENDERER_PRESENTVSYNC;
|
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);
|
sdlRenderer = SDL_CreateRenderer (sdlWindow, -1, sdlFlags);
|
||||||
|
|
||||||
OpenGLBindings::Init ();
|
OpenGLBindings::Init ();
|
||||||
|
|||||||
@@ -15,6 +15,18 @@ namespace lime {
|
|||||||
if (flags & WINDOW_FLAG_RESIZABLE) sdlFlags |= SDL_WINDOW_RESIZABLE;
|
if (flags & WINDOW_FLAG_RESIZABLE) sdlFlags |= SDL_WINDOW_RESIZABLE;
|
||||||
if (flags & WINDOW_FLAG_BORDERLESS) sdlFlags |= SDL_WINDOW_BORDERLESS;
|
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);
|
sdlWindow = SDL_CreateWindow (title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, sdlFlags);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user