mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
Fix disabling blending,
--HG-- branch : minor
This commit is contained in:
@@ -206,7 +206,7 @@ bool Graphics::setMode(int width, int height, int pixelwidth, int pixelheight, b
|
|||||||
setViewportSize(width, height, pixelwidth, pixelheight);
|
setViewportSize(width, height, pixelwidth, pixelheight);
|
||||||
|
|
||||||
// Enable blending
|
// Enable blending
|
||||||
glEnable(GL_BLEND);
|
gl.setEnableState(OpenGL::ENABLE_BLEND, true);
|
||||||
|
|
||||||
// Auto-generated mipmaps should be the best quality possible
|
// Auto-generated mipmaps should be the best quality possible
|
||||||
if (!gl.isCoreProfile())
|
if (!gl.isCoreProfile())
|
||||||
@@ -1280,15 +1280,21 @@ void Graphics::setBlendState(const BlendState &blend)
|
|||||||
throw love::Exception("The 'min' and 'max' blend operations are not supported on this system.");
|
throw love::Exception("The 'min' and 'max' blend operations are not supported on this system.");
|
||||||
}
|
}
|
||||||
|
|
||||||
GLenum opRGB = getGLBlendOperation(blend.operationRGB);
|
if (blend.enable != gl.isStateEnabled(OpenGL::ENABLE_BLEND))
|
||||||
GLenum opA = getGLBlendOperation(blend.operationA);
|
gl.setEnableState(OpenGL::ENABLE_BLEND, blend.enable);
|
||||||
GLenum srcRGB = getGLBlendFactor(blend.srcFactorRGB);
|
|
||||||
GLenum srcA = getGLBlendFactor(blend.srcFactorA);
|
|
||||||
GLenum dstRGB = getGLBlendFactor(blend.dstFactorRGB);
|
|
||||||
GLenum dstA = getGLBlendFactor(blend.dstFactorA);
|
|
||||||
|
|
||||||
glBlendEquationSeparate(opRGB, opA);
|
if (blend.enable)
|
||||||
glBlendFuncSeparate(srcRGB, dstRGB, srcA, dstA);
|
{
|
||||||
|
GLenum opRGB = getGLBlendOperation(blend.operationRGB);
|
||||||
|
GLenum opA = getGLBlendOperation(blend.operationA);
|
||||||
|
GLenum srcRGB = getGLBlendFactor(blend.srcFactorRGB);
|
||||||
|
GLenum srcA = getGLBlendFactor(blend.srcFactorA);
|
||||||
|
GLenum dstRGB = getGLBlendFactor(blend.dstFactorRGB);
|
||||||
|
GLenum dstA = getGLBlendFactor(blend.dstFactorA);
|
||||||
|
|
||||||
|
glBlendEquationSeparate(opRGB, opA);
|
||||||
|
glBlendFuncSeparate(srcRGB, dstRGB, srcA, dstA);
|
||||||
|
}
|
||||||
|
|
||||||
states.back().blend = blend;
|
states.back().blend = blend;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,6 +205,7 @@ void OpenGL::setupContext()
|
|||||||
state.boundFramebuffers[i] = std::numeric_limits<GLuint>::max();
|
state.boundFramebuffers[i] = std::numeric_limits<GLuint>::max();
|
||||||
bindFramebuffer(FRAMEBUFFER_ALL, getDefaultFBO());
|
bindFramebuffer(FRAMEBUFFER_ALL, getDefaultFBO());
|
||||||
|
|
||||||
|
setEnableState(ENABLE_BLEND, state.enableState[ENABLE_BLEND]);
|
||||||
setEnableState(ENABLE_DEPTH_TEST, state.enableState[ENABLE_DEPTH_TEST]);
|
setEnableState(ENABLE_DEPTH_TEST, state.enableState[ENABLE_DEPTH_TEST]);
|
||||||
setEnableState(ENABLE_STENCIL_TEST, state.enableState[ENABLE_STENCIL_TEST]);
|
setEnableState(ENABLE_STENCIL_TEST, state.enableState[ENABLE_STENCIL_TEST]);
|
||||||
setEnableState(ENABLE_SCISSOR_TEST, state.enableState[ENABLE_SCISSOR_TEST]);
|
setEnableState(ENABLE_SCISSOR_TEST, state.enableState[ENABLE_SCISSOR_TEST]);
|
||||||
@@ -810,6 +811,9 @@ void OpenGL::setEnableState(EnableState enablestate, bool enable)
|
|||||||
|
|
||||||
switch (enablestate)
|
switch (enablestate)
|
||||||
{
|
{
|
||||||
|
case ENABLE_BLEND:
|
||||||
|
glstate = GL_BLEND;
|
||||||
|
break;
|
||||||
case ENABLE_DEPTH_TEST:
|
case ENABLE_DEPTH_TEST:
|
||||||
glstate = GL_DEPTH_TEST;
|
glstate = GL_DEPTH_TEST;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ public:
|
|||||||
|
|
||||||
enum EnableState
|
enum EnableState
|
||||||
{
|
{
|
||||||
|
ENABLE_BLEND,
|
||||||
ENABLE_DEPTH_TEST,
|
ENABLE_DEPTH_TEST,
|
||||||
ENABLE_STENCIL_TEST,
|
ENABLE_STENCIL_TEST,
|
||||||
ENABLE_SCISSOR_TEST,
|
ENABLE_SCISSOR_TEST,
|
||||||
|
|||||||
Reference in New Issue
Block a user