mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-11 07:34:33 +02:00
#23 fix texture bordrr color for OGL ES
This commit is contained in:
@@ -108,6 +108,9 @@
|
|||||||
#define GL_RGBA16F GL_RGBA
|
#define GL_RGBA16F GL_RGBA
|
||||||
#define GL_HALF_FLOAT GL_HALF_FLOAT_OES
|
#define GL_HALF_FLOAT GL_HALF_FLOAT_OES
|
||||||
|
|
||||||
|
#define GL_CLAMP_TO_BORDER GL_CLAMP_TO_BORDER_EXT
|
||||||
|
#define GL_TEXTURE_BORDER_COLOR GL_TEXTURE_BORDER_COLOR_EXT
|
||||||
|
|
||||||
#define GL_STENCIL_TEST_TWO_SIDE_EXT 0
|
#define GL_STENCIL_TEST_TWO_SIDE_EXT 0
|
||||||
#define glGetProgramBinary(...)
|
#define glGetProgramBinary(...)
|
||||||
#define glProgramBinary(...)
|
#define glProgramBinary(...)
|
||||||
@@ -222,6 +225,7 @@ namespace Core {
|
|||||||
bool discardFrame;
|
bool discardFrame;
|
||||||
bool texNPOT;
|
bool texNPOT;
|
||||||
bool texRG;
|
bool texRG;
|
||||||
|
bool texBorder;
|
||||||
bool texFloat, texFloatLinear;
|
bool texFloat, texFloatLinear;
|
||||||
bool texHalf, texHalfLinear;
|
bool texHalf, texHalfLinear;
|
||||||
char stencil;
|
char stencil;
|
||||||
@@ -447,6 +451,7 @@ namespace Core {
|
|||||||
support.discardFrame = extSupport(ext, "_discard_framebuffer");
|
support.discardFrame = extSupport(ext, "_discard_framebuffer");
|
||||||
support.texNPOT = extSupport(ext, "_texture_npot") || extSupport(ext, "_texture_non_power_of_two");
|
support.texNPOT = extSupport(ext, "_texture_npot") || extSupport(ext, "_texture_non_power_of_two");
|
||||||
support.texRG = extSupport(ext, "_texture_rg "); // hope that isn't last extension in string ;)
|
support.texRG = extSupport(ext, "_texture_rg "); // hope that isn't last extension in string ;)
|
||||||
|
support.texBorder = extSupport(ext, "_texture_border_clamp");
|
||||||
support.texFloatLinear = extSupport(ext, "GL_ARB_texture_float") || extSupport(ext, "_texture_float_linear");
|
support.texFloatLinear = extSupport(ext, "GL_ARB_texture_float") || extSupport(ext, "_texture_float_linear");
|
||||||
support.texFloat = support.texFloatLinear || extSupport(ext, "_texture_float");
|
support.texFloat = support.texFloatLinear || extSupport(ext, "_texture_float");
|
||||||
support.texHalfLinear = extSupport(ext, "GL_ARB_texture_float") || extSupport(ext, "_texture_half_float_linear");
|
support.texHalfLinear = extSupport(ext, "GL_ARB_texture_float") || extSupport(ext, "_texture_half_float_linear");
|
||||||
@@ -478,6 +483,7 @@ namespace Core {
|
|||||||
LOG(" discard frame : %s\n", support.discardFrame ? "true" : "false");
|
LOG(" discard frame : %s\n", support.discardFrame ? "true" : "false");
|
||||||
LOG(" NPOT textures : %s\n", support.texNPOT ? "true" : "false");
|
LOG(" NPOT textures : %s\n", support.texNPOT ? "true" : "false");
|
||||||
LOG(" RG textures : %s\n", support.texRG ? "true" : "false");
|
LOG(" RG textures : %s\n", support.texRG ? "true" : "false");
|
||||||
|
LOG(" border color : %s\n", support.texBorder ? "true" : "false");
|
||||||
LOG(" float textures : float = %s, half = %s\n",
|
LOG(" float textures : float = %s, half = %s\n",
|
||||||
support.texFloat ? (support.texFloatLinear ? "linear" : "nearest") : "false",
|
support.texFloat ? (support.texFloatLinear ? "linear" : "nearest") : "false",
|
||||||
support.texHalf ? (support.texHalfLinear ? "linear" : "nearest") : "false");
|
support.texHalf ? (support.texHalfLinear ? "linear" : "nearest") : "false");
|
||||||
|
@@ -58,9 +58,10 @@ struct Texture {
|
|||||||
glTexParameteri(target, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
|
glTexParameteri(target, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
glTexParameteri(target, GL_TEXTURE_WRAP_S, isShadow ? GL_CLAMP_TO_BORDER : GL_CLAMP_TO_EDGE);
|
bool border = isShadow && Core::support.texBorder;
|
||||||
glTexParameteri(target, GL_TEXTURE_WRAP_T, isShadow ? GL_CLAMP_TO_BORDER : GL_CLAMP_TO_EDGE);
|
glTexParameteri(target, GL_TEXTURE_WRAP_S, border ? GL_CLAMP_TO_BORDER : GL_CLAMP_TO_EDGE);
|
||||||
if (isShadow) {
|
glTexParameteri(target, GL_TEXTURE_WRAP_T, border ? GL_CLAMP_TO_BORDER : GL_CLAMP_TO_EDGE);
|
||||||
|
if (border) {
|
||||||
float color[] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
float color[] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||||
glTexParameterfv(target, GL_TEXTURE_BORDER_COLOR, color);
|
glTexParameterfv(target, GL_TEXTURE_BORDER_COLOR, color);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user