mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
Add support for falling back to glBlendEquationEXT if necessary.
This should help keep LÖVE from crashing on old cards with crappy drivers.
This commit is contained in:
@@ -511,10 +511,24 @@ namespace opengl
|
||||
{
|
||||
glAlphaFunc(GL_GEQUAL, 0);
|
||||
|
||||
if (mode == BLEND_SUBTRACTIVE)
|
||||
glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
|
||||
else
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
if (GLEE_VERSION_1_4 || GLEE_ARB_imaging) {
|
||||
if (mode == BLEND_SUBTRACTIVE) {
|
||||
glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
|
||||
} else {
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
}
|
||||
} else if (GLEE_EXT_blend_minmax && GLEE_EXT_blend_subtract) {
|
||||
if (mode == BLEND_SUBTRACTIVE) {
|
||||
glBlendEquationEXT(GL_FUNC_REVERSE_SUBTRACT_EXT);
|
||||
} else {
|
||||
glBlendEquationEXT(GL_FUNC_ADD_EXT);
|
||||
}
|
||||
} else {
|
||||
if (mode == BLEND_SUBTRACTIVE) {
|
||||
std::cerr << "This graphics card does not support the subtract blend mode!" << std::endl;
|
||||
}
|
||||
// GL_FUNC_ADD is the default even without access to glBlendEquation, so that'll still work.
|
||||
}
|
||||
|
||||
if (mode == BLEND_ALPHA)
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
**/
|
||||
|
||||
#include "wrap_Graphics.h"
|
||||
#include "GLee.h"
|
||||
#include <graphics/DrawQable.h>
|
||||
#include <image/ImageData.h>
|
||||
#include <font/Rasterizer.h>
|
||||
@@ -793,6 +794,9 @@ namespace opengl
|
||||
if (!Image::hasNpot())
|
||||
supported = false;
|
||||
break;
|
||||
case Graphics::SUPPORT_SUBTRACTIVE:
|
||||
supported = (GLEE_VERSION_1_4 || GLEE_ARB_imaging) || (GLEE_EXT_blend_minmax && GLEE_EXT_blend_subtract);
|
||||
break;
|
||||
default:
|
||||
supported = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user