Browse Source

Hack fix for render-to-texture failing on iOS.

Lasse Öörni 12 years ago
parent
commit
20b67638e3

+ 5 - 0
Source/Engine/Graphics/OpenGL/OGLGraphics.cpp

@@ -2514,6 +2514,11 @@ void Graphics::CheckFeatureSupport(String& extensions)
     }
     else
     {
+        #ifdef IOS
+        // iOS hack: depth renderbuffer seems to fail, so use depth textures for everything
+        // if supported
+        glesDepthStencilFormat = GL_DEPTH_COMPONENT;
+        #endif
         shadowMapFormat_ = GL_DEPTH_COMPONENT;
         hiresShadowMapFormat_ = 0;
     }

+ 2 - 1
Source/Engine/Graphics/OpenGL/OGLTexture2D.cpp

@@ -419,7 +419,8 @@ bool Texture2D::Create()
     #ifndef GL_ES_VERSION_2_0
     if (format == Graphics::GetDepthStencilFormat())
     #else
-    if (format == Graphics::GetDepthStencilFormat() || (!graphics_->GetShadowMapFormat() && externalFormat == GL_DEPTH_COMPONENT))
+    if (format == GL_DEPTH_COMPONENT16 || format == GL_DEPTH_COMPONENT24_OES || format == GL_DEPTH24_STENCIL8_OES ||
+        (format == GL_DEPTH_COMPONENT && !graphics_->GetShadowMapFormat()))
     #endif
     {
         if (renderSurface_)