|| theSizeXY.y() != aHeightP2)
{
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
- TCollection_AsciiString ("Error: Mipmap NPOT Textures (") + theSizeXY.x() + "x" + theSizeXY.y() + ")"
+ TCollection_AsciiString ("Warning: Mipmap NPOT Textures (") + theSizeXY.x() + "x" + theSizeXY.y() + ")"
" are not supported by OpenGL ES 2.0 [" + myResourceId +"]");
- Release (theCtx.get());
- return false;
+ myMaxMipLevel = 0;
}
}
#endif
return false;
}
+#if defined(GL_ES_VERSION_2_0)
+ if (theToGenMipmap
+ && !theCtx->IsGlGreaterEqual (3, 0)
+ && (aFormat.PixelFormat() == GL_SRGB_EXT
+ || aFormat.PixelFormat() == GL_SRGB_ALPHA_EXT))
+ {
+ theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
+ TCollection_AsciiString ("Warning, GL_EXT_sRGB disallows generation of mipmaps - fallback using non-sRGB format")
+ + " [" + myResourceId +"]");
+ aFormat.SetPixelFormat (aFormat.PixelFormat() == GL_SRGB_EXT ? GL_RGB : GL_RGBA);
+ aFormat.SetInternalFormat(aFormat.PixelFormat() == GL_SRGB_EXT ? GL_RGB8 : GL_RGBA8);
+ }
+#endif
+
myTarget = GL_TEXTURE_CUBE_MAP;
myNbSamples = 1;
mySizeX = (GLsizei )theSize;
if (anErr != GL_NO_ERROR)
{
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
- TCollection_AsciiString ("Unable to initialize side of cubemap. Error ") + OpenGl_Context::FormatGlError (anErr));
+ TCollection_AsciiString ("Error: cubemap side ") + (int )theSize + "x" + (int )theSize
+ + " IF: " + OpenGl_TextureFormat::FormatFormat (anIntFormat)
+ + " PF: " + OpenGl_TextureFormat::FormatFormat (aFormat.PixelFormat())
+ + " DT: " + OpenGl_TextureFormat::FormatDataType (aFormat.DataType())
+ + " can not be created with error " + OpenGl_Context::FormatGlError (anErr) + ".");
Unbind (theCtx);
Release (theCtx.get());
return false;
case 0x8050: return "GL_RGB5";
case GL_RGB8: return "GL_RGB8";
case GL_SRGB8: return "GL_SRGB8";
+ case GL_SRGB_EXT: return "GL_SRGB_EXT";
case 0x8052: return "GL_RGB10";
case 0x8053: return "GL_RGB12";
case 0x8054: return "GL_RGB16";
// RGBA variations
case GL_RGBA: return "GL_RGBA";
case GL_RGBA8: return "GL_RGBA8";
- case GL_SRGB8_ALPHA8: return "GL_SRGB8_ALPHA8";
+ case GL_SRGB8_ALPHA8: return "GL_SRGB8_ALPHA8";
+ case GL_SRGB_ALPHA_EXT: return "GL_SRGB_ALPHA_EXT";
case GL_RGB10_A2: return "GL_RGB10_A2";
case 0x805A: return "GL_RGBA12";
case 0x805B: return "GL_RGBA16";
if (theIsColorMap
&& theCtx->ToRenderSRGB())
{
+ #if defined(GL_ES_VERSION_2_0)
+ if (!theCtx->IsGlGreaterEqual (3, 0))
+ {
+ aFormat.SetPixelFormat (GL_SRGB_ALPHA_EXT);
+ }
+ #endif
aFormat.SetInternalFormat (GL_SRGB8_ALPHA8);
}
return aFormat;
// ask driver to convert data to RGB8 to save memory
aFormat.SetNbComponents (3);
aFormat.SetInternalFormat (GL_RGB8);
+ aFormat.SetPixelFormat (GL_RGBA);
+ aFormat.SetDataType (GL_UNSIGNED_BYTE);
if (theIsColorMap
&& theCtx->ToRenderSRGB())
{
// conversion is not supported
aFormat.SetNbComponents (4);
aFormat.SetInternalFormat (GL_RGBA8);
+ aFormat.SetPixelFormat (GL_RGBA);
+ aFormat.SetDataType (GL_UNSIGNED_BYTE);
if (theIsColorMap
&& theCtx->ToRenderSRGB())
{
+ if (!theCtx->IsGlGreaterEqual (3, 0))
+ {
+ aFormat.SetPixelFormat (GL_SRGB_ALPHA_EXT);
+ }
aFormat.SetInternalFormat (GL_SRGB8_ALPHA8);
}
#endif
- aFormat.SetPixelFormat (GL_RGBA);
- aFormat.SetDataType (GL_UNSIGNED_BYTE);
return aFormat;
}
case Image_Format_BGR32:
if (theIsColorMap
&& theCtx->ToRenderSRGB())
{
+ #if defined(GL_ES_VERSION_2_0)
+ if (!theCtx->IsGlGreaterEqual (3, 0))
+ {
+ aFormat.SetPixelFormat (GL_SRGB_EXT);
+ }
+ #endif
aFormat.SetInternalFormat (GL_SRGB8);
}
return aFormat;
}
aFormat.SetNbComponents (3);
aFormat.SetInternalFormat (GL_RGB8);
+ aFormat.SetPixelFormat (GL_BGR); // equals to GL_BGR_EXT
+ aFormat.SetDataType (GL_UNSIGNED_BYTE);
if (theIsColorMap
&& theCtx->ToRenderSRGB())
{
aFormat.SetInternalFormat (GL_SRGB8);
}
- aFormat.SetPixelFormat (GL_BGR); // equals to GL_BGR_EXT
- aFormat.SetDataType (GL_UNSIGNED_BYTE);
#endif
return aFormat;
}
return aFormat;
}
case GL_SRGB8_ALPHA8:
+ case GL_SRGB_ALPHA_EXT:
case GL_RGBA8:
case GL_RGBA:
{
aFormat.SetPixelFormat (GL_RGBA);
aFormat.SetDataType (GL_UNSIGNED_BYTE);
aFormat.SetImageFormat (Image_Format_RGBA);
- if (theSizedFormat == GL_SRGB8_ALPHA8
- && !theCtx->ToRenderSRGB())
+ if ((theSizedFormat == GL_SRGB8_ALPHA8 || theSizedFormat == GL_SRGB_ALPHA_EXT))
{
- aFormat.SetInternalFormat (GL_RGBA8); // fallback format
+ if (theCtx->ToRenderSRGB())
+ {
+ #if defined(GL_ES_VERSION_2_0)
+ if (!theCtx->IsGlGreaterEqual (3, 0))
+ {
+ aFormat.SetPixelFormat (GL_SRGB_ALPHA_EXT);
+ }
+ #endif
+ }
+ else
+ {
+ aFormat.SetInternalFormat (GL_RGBA8); // fallback format
+ }
}
return aFormat;
}
case GL_SRGB8:
+ case GL_SRGB_EXT:
case GL_RGB8:
case GL_RGB:
{
aFormat.SetPixelFormat (GL_RGB);
aFormat.SetDataType (GL_UNSIGNED_BYTE);
aFormat.SetImageFormat (Image_Format_RGB);
- if (theSizedFormat == GL_SRGB8
- && !theCtx->ToRenderSRGB())
- {
- aFormat.SetInternalFormat (GL_RGB8); // fallback format
+ if ((theSizedFormat == GL_SRGB8 || theSizedFormat == GL_SRGB_EXT))
+ {
+ if (theCtx->ToRenderSRGB())
+ {
+ #if defined(GL_ES_VERSION_2_0)
+ if (!theCtx->IsGlGreaterEqual (3, 0))
+ {
+ aFormat.SetPixelFormat (GL_SRGB_EXT);
+ }
+ #endif
+ }
+ else
+ {
+ aFormat.SetInternalFormat (GL_RGB8); // fallback format
+ }
}
return aFormat;
}