mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Added support for GL_EXT_texture_edge_clamp as well since some GL implementations don't expose GL_SGIS_texture_edge_clamp even when clamp-to-edge functionality is supported. Fixes #880
This commit is contained in:
parent
e38a26ec25
commit
45577de60a
@ -45,6 +45,7 @@
|
||||
// Core since 1.0
|
||||
#define GLEXT_multitexture true
|
||||
#define GLEXT_texture_edge_clamp true
|
||||
#define GLEXT_EXT_texture_edge_clamp true
|
||||
#define GLEXT_blend_minmax true
|
||||
#define GLEXT_glClientActiveTexture glClientActiveTexture
|
||||
#define GLEXT_glActiveTexture glActiveTexture
|
||||
@ -130,6 +131,9 @@
|
||||
#define GLEXT_texture_edge_clamp sfogl_ext_SGIS_texture_edge_clamp
|
||||
#define GLEXT_GL_CLAMP_TO_EDGE GL_CLAMP_TO_EDGE_SGIS
|
||||
|
||||
// Core since 1.2 - EXT_texture_edge_clamp
|
||||
#define GLEXT_EXT_texture_edge_clamp sfogl_ext_EXT_texture_edge_clamp
|
||||
|
||||
// Core since 1.2 - EXT_blend_minmax
|
||||
#define GLEXT_blend_minmax sfogl_ext_EXT_blend_minmax
|
||||
#define GLEXT_glBlendEquation glBlendEquationEXT
|
||||
|
@ -4,6 +4,7 @@
|
||||
// lua LoadGen.lua -style=pointer_c -spec=gl -version=1.1 -indent=space -prefix=sf -extfile=GLExtensions.txt GLLoader
|
||||
|
||||
SGIS_texture_edge_clamp
|
||||
//EXT_texture_edge_clamp
|
||||
EXT_blend_minmax
|
||||
EXT_blend_subtract
|
||||
ARB_multitexture
|
||||
|
@ -50,6 +50,7 @@ static sf::GlFunctionPointer IntGetProcAddress(const char* name)
|
||||
}
|
||||
|
||||
int sfogl_ext_SGIS_texture_edge_clamp = sfogl_LOAD_FAILED;
|
||||
int sfogl_ext_EXT_texture_edge_clamp = sfogl_LOAD_FAILED;
|
||||
int sfogl_ext_EXT_blend_minmax = sfogl_LOAD_FAILED;
|
||||
int sfogl_ext_EXT_blend_subtract = sfogl_LOAD_FAILED;
|
||||
int sfogl_ext_ARB_multitexture = sfogl_LOAD_FAILED;
|
||||
@ -317,8 +318,9 @@ typedef struct sfogl_StrToExtMap_s
|
||||
PFN_LOADFUNCPOINTERS LoadExtension;
|
||||
} sfogl_StrToExtMap;
|
||||
|
||||
static sfogl_StrToExtMap ExtensionMap[12] = {
|
||||
static sfogl_StrToExtMap ExtensionMap[13] = {
|
||||
{"GL_SGIS_texture_edge_clamp", &sfogl_ext_SGIS_texture_edge_clamp, NULL},
|
||||
{"GL_EXT_texture_edge_clamp", &sfogl_ext_EXT_texture_edge_clamp, NULL},
|
||||
{"GL_EXT_blend_minmax", &sfogl_ext_EXT_blend_minmax, Load_EXT_blend_minmax},
|
||||
{"GL_EXT_blend_subtract", &sfogl_ext_EXT_blend_subtract, NULL},
|
||||
{"GL_ARB_multitexture", &sfogl_ext_ARB_multitexture, Load_ARB_multitexture},
|
||||
@ -332,7 +334,7 @@ static sfogl_StrToExtMap ExtensionMap[12] = {
|
||||
{"GL_EXT_framebuffer_object", &sfogl_ext_EXT_framebuffer_object, Load_EXT_framebuffer_object}
|
||||
};
|
||||
|
||||
static int g_extensionMapSize = 12;
|
||||
static int g_extensionMapSize = 13;
|
||||
|
||||
static sfogl_StrToExtMap *FindExtEntry(const char *extensionName)
|
||||
{
|
||||
@ -350,6 +352,7 @@ static sfogl_StrToExtMap *FindExtEntry(const char *extensionName)
|
||||
static void ClearExtensionVars()
|
||||
{
|
||||
sfogl_ext_SGIS_texture_edge_clamp = sfogl_LOAD_FAILED;
|
||||
sfogl_ext_EXT_texture_edge_clamp = sfogl_LOAD_FAILED;
|
||||
sfogl_ext_EXT_blend_minmax = sfogl_LOAD_FAILED;
|
||||
sfogl_ext_EXT_blend_subtract = sfogl_LOAD_FAILED;
|
||||
sfogl_ext_ARB_multitexture = sfogl_LOAD_FAILED;
|
||||
|
@ -174,6 +174,7 @@ extern "C" {
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
extern int sfogl_ext_SGIS_texture_edge_clamp;
|
||||
extern int sfogl_ext_EXT_texture_edge_clamp;
|
||||
extern int sfogl_ext_EXT_blend_minmax;
|
||||
extern int sfogl_ext_EXT_blend_subtract;
|
||||
extern int sfogl_ext_ARB_multitexture;
|
||||
@ -188,6 +189,8 @@ extern int sfogl_ext_EXT_framebuffer_object;
|
||||
|
||||
#define GL_CLAMP_TO_EDGE_SGIS 0x812F
|
||||
|
||||
#define GL_CLAMP_TO_EDGE_EXT 0x812F
|
||||
|
||||
#define GL_BLEND_EQUATION_EXT 0x8009
|
||||
#define GL_FUNC_ADD_EXT 0x8006
|
||||
#define GL_MAX_EXT 0x8008
|
||||
|
@ -158,7 +158,9 @@ bool Texture::create(unsigned int width, unsigned int height)
|
||||
// Make sure that the current texture binding will be preserved
|
||||
priv::TextureSaver save;
|
||||
|
||||
if (!m_isRepeated && !GLEXT_texture_edge_clamp)
|
||||
static bool textureEdgeClamp = GLEXT_texture_edge_clamp || GLEXT_EXT_texture_edge_clamp;
|
||||
|
||||
if (!m_isRepeated && !textureEdgeClamp)
|
||||
{
|
||||
static bool warned = false;
|
||||
|
||||
@ -175,8 +177,8 @@ bool Texture::create(unsigned int width, unsigned int height)
|
||||
// Initialize the texture
|
||||
glCheck(glBindTexture(GL_TEXTURE_2D, m_texture));
|
||||
glCheck(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_actualSize.x, m_actualSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL));
|
||||
glCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, m_isRepeated ? GL_REPEAT : (GLEXT_texture_edge_clamp ? GLEXT_GL_CLAMP_TO_EDGE : GLEXT_GL_CLAMP)));
|
||||
glCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, m_isRepeated ? GL_REPEAT : (GLEXT_texture_edge_clamp ? GLEXT_GL_CLAMP_TO_EDGE : GLEXT_GL_CLAMP)));
|
||||
glCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, m_isRepeated ? GL_REPEAT : (textureEdgeClamp ? GLEXT_GL_CLAMP_TO_EDGE : GLEXT_GL_CLAMP)));
|
||||
glCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, m_isRepeated ? GL_REPEAT : (textureEdgeClamp ? GLEXT_GL_CLAMP_TO_EDGE : GLEXT_GL_CLAMP)));
|
||||
glCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, m_isSmooth ? GL_LINEAR : GL_NEAREST));
|
||||
glCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, m_isSmooth ? GL_LINEAR : GL_NEAREST));
|
||||
m_cacheId = getUniqueId();
|
||||
@ -480,7 +482,9 @@ void Texture::setRepeated(bool repeated)
|
||||
// Make sure that the current texture binding will be preserved
|
||||
priv::TextureSaver save;
|
||||
|
||||
if (!m_isRepeated && !GLEXT_texture_edge_clamp)
|
||||
static bool textureEdgeClamp = GLEXT_texture_edge_clamp || GLEXT_EXT_texture_edge_clamp;
|
||||
|
||||
if (!m_isRepeated && !textureEdgeClamp)
|
||||
{
|
||||
static bool warned = false;
|
||||
|
||||
@ -495,8 +499,8 @@ void Texture::setRepeated(bool repeated)
|
||||
}
|
||||
|
||||
glCheck(glBindTexture(GL_TEXTURE_2D, m_texture));
|
||||
glCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, m_isRepeated ? GL_REPEAT : (GLEXT_texture_edge_clamp ? GLEXT_GL_CLAMP_TO_EDGE : GLEXT_GL_CLAMP)));
|
||||
glCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, m_isRepeated ? GL_REPEAT : (GLEXT_texture_edge_clamp ? GLEXT_GL_CLAMP_TO_EDGE : GLEXT_GL_CLAMP)));
|
||||
glCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, m_isRepeated ? GL_REPEAT : (textureEdgeClamp ? GLEXT_GL_CLAMP_TO_EDGE : GLEXT_GL_CLAMP)));
|
||||
glCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, m_isRepeated ? GL_REPEAT : (textureEdgeClamp ? GLEXT_GL_CLAMP_TO_EDGE : GLEXT_GL_CLAMP)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user