mirror of
https://github.com/love2d/love.git
synced 2026-08-17 02:58:31 +02:00
Add new variants of love.graphics.clear for controlling how the depth and stencil buffers are cleared.
- Add love.graphics.clear(r, g, b, a [, stencilvalue, depthvalue]). - Add love.graphics.clear(color1, color2, …, [, stencilvalue, depthvalue]). - Add love.graphics.clear(false, stencilvalue, depthvalue). stencilvalue and depthvalue are either true, false, or a number. True is the default behaviour and clears that buffer to the default value (0 for stencil, 1 for depth), false prevents clearing. The third variant listed above only clears the depth and/or stencil buffers and not the color buffer. --HG-- branch : minor
This commit is contained in:
@@ -60,7 +60,11 @@ static GLenum createFBO(GLuint &framebuffer, TextureType texType, PixelFormat fo
|
||||
gl.framebufferTexture(attachment, texType, texture, 0, layer, face);
|
||||
|
||||
if (isPixelFormatDepthStencil(format))
|
||||
{
|
||||
glClearDepth(1.0);
|
||||
glClearStencil(0);
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
}
|
||||
else
|
||||
{
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
@@ -116,7 +120,11 @@ static bool createRenderbuffer(int width, int height, int &samples, PixelFormat
|
||||
if (status == GL_FRAMEBUFFER_COMPLETE && (reqsamples <= 1 || samples > 1))
|
||||
{
|
||||
if (isPixelFormatDepthStencil(pixelformat))
|
||||
{
|
||||
glClearDepth(1.0);
|
||||
glClearStencil(0);
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Initialize the buffer to transparent black.
|
||||
|
||||
Reference in New Issue
Block a user