I just found one bug on driver when setRenderTarget or in cases of clearing color buffer,
if last time use drawAll(), the material.ColorMask is locked to ECP_NONE or any specific channel. (ex: via OverrideMaterial),
then next time the behavior for glClear( ...) will be affected. (for ECP_NONE, glClear CANNOT clear the color buffer's R, G, B, A)
So the source code is updated this way to solve this bug:
Code: Select all
//! clears the zbuffer and color buffer
void COpenGLDriver::clearBuffers(bool backBuffer, bool zBuffer, bool stencilBuffer, SColor color)
{
GLbitfield mask = 0;
if (backBuffer)
{
const f32 inv = 1.0f / 255.0f;
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); // <=== fix bug for glClearColor
LastMaterial.ColorMask = ECP_ALL;
glClearColor(color.getRed() * inv, color.getGreen() * inv,
color.getBlue() * inv, color.getAlpha() * inv);
mask |= GL_COLOR_BUFFER_BIT;
}
if (zBuffer)
{
glDepthMask(GL_TRUE);
LastMaterial.ZWriteEnable=true;
mask |= GL_DEPTH_BUFFER_BIT;
}
if (stencilBuffer)
mask |= GL_STENCIL_BUFFER_BIT;
if (mask)
glClear(mask);
}
Someone can try if interesting on this issue.