|
@@ -48,6 +48,16 @@ GLenum glWrapModes[] =
|
|
|
#endif
|
|
#endif
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+#ifndef GL_ES_VERSION_2_0
|
|
|
|
|
+GLenum gl3WrapModes[] =
|
|
|
|
|
+{
|
|
|
|
|
+ GL_REPEAT,
|
|
|
|
|
+ GL_MIRRORED_REPEAT,
|
|
|
|
|
+ GL_CLAMP_TO_EDGE,
|
|
|
|
|
+ GL_CLAMP_TO_BORDER
|
|
|
|
|
+};
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
static const char* addressModeNames[] =
|
|
static const char* addressModeNames[] =
|
|
|
{
|
|
{
|
|
|
"wrap",
|
|
"wrap",
|
|
@@ -67,6 +77,15 @@ static const char* filterModeNames[] =
|
|
|
0
|
|
0
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+GLenum GetWrapMode(TextureAddressMode mode)
|
|
|
|
|
+{
|
|
|
|
|
+ #ifndef GL_ES_VERSION_2_0
|
|
|
|
|
+ return Graphics::GetGL3Support() ? gl3WrapModes[mode] : glWrapModes[mode];
|
|
|
|
|
+ #else
|
|
|
|
|
+ return glWrapModes[mode];
|
|
|
|
|
+ #endif
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
Texture::Texture(Context* context) :
|
|
Texture::Texture(Context* context) :
|
|
|
Resource(context),
|
|
Resource(context),
|
|
|
GPUObject(GetSubsystem<Graphics>()),
|
|
GPUObject(GetSubsystem<Graphics>()),
|
|
@@ -170,10 +189,10 @@ void Texture::UpdateParameters()
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
// Wrapping
|
|
// Wrapping
|
|
|
- glTexParameteri(target_, GL_TEXTURE_WRAP_S, glWrapModes[addressMode_[COORD_U]]);
|
|
|
|
|
- glTexParameteri(target_, GL_TEXTURE_WRAP_T, glWrapModes[addressMode_[COORD_V]]);
|
|
|
|
|
|
|
+ glTexParameteri(target_, GL_TEXTURE_WRAP_S, GetWrapMode(addressMode_[COORD_U]));
|
|
|
|
|
+ glTexParameteri(target_, GL_TEXTURE_WRAP_T, GetWrapMode(addressMode_[COORD_V]));
|
|
|
#ifndef GL_ES_VERSION_2_0
|
|
#ifndef GL_ES_VERSION_2_0
|
|
|
- glTexParameteri(target_, GL_TEXTURE_WRAP_R, glWrapModes[addressMode_[COORD_W]]);
|
|
|
|
|
|
|
+ glTexParameteri(target_, GL_TEXTURE_WRAP_R, GetWrapMode(addressMode_[COORD_W]));
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
TextureFilterMode filterMode = filterMode_;
|
|
TextureFilterMode filterMode = filterMode_;
|