浏览代码

Fixed iOS build.

Lasse Öörni 13 年之前
父节点
当前提交
dd708d6e69

+ 4 - 4
Engine/Graphics/OpenGL/OGLGraphics.cpp

@@ -142,6 +142,7 @@ Graphics::Graphics(Context* context_) :
     deferredSupport_(false),
     hardwareDepthSupport_(false),
     dxtTextureSupport_(false),
+    etcTextureSupport_(false),
     numPrimitives_(0),
     numBatches_(0),
     defaultTextureFilterMode_(FILTER_BILINEAR),
@@ -303,6 +304,7 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool vsync, bool
         dxtTextureSupport_ = CheckExtension("EXT_texture_compression_s3tc");
         #else
         dxtTextureSupport_ = CheckExtension("EXT_texture_compression_dxt1");
+        etcTextureSupport_ = CheckExtension("OES_compressed_ETC1_RGB8_texture");
         #endif
     }
     
@@ -1587,11 +1589,9 @@ unsigned Graphics::GetFormat(CompressedFormat format) const
 {
     switch (format)
     {
-    #if !defined(GL_ES_VERSION_2_0) || defined(ANDROID)
     case CF_DXT1:
         return dxtTextureSupport_ ? GL_COMPRESSED_RGBA_S3TC_DXT1_EXT : 0;
-    #endif
-        
+
     #ifndef GL_ES_VERSION_2_0
     case CF_DXT3:
         return dxtTextureSupport_ ? GL_COMPRESSED_RGBA_S3TC_DXT3_EXT : 0;
@@ -1600,7 +1600,7 @@ unsigned Graphics::GetFormat(CompressedFormat format) const
         return dxtTextureSupport_ ? GL_COMPRESSED_RGBA_S3TC_DXT5_EXT : 0;
     #else
     case CF_ETC1:
-        return GL_ETC1_RGB8_OES;
+        return etcTextureSupport_ ? GL_ETC1_RGB8_OES : 0;
     #endif
     }
     

+ 2 - 0
Engine/Graphics/OpenGL/OGLGraphics.h

@@ -390,6 +390,8 @@ private:
     bool hardwareDepthSupport_;
     /// DXT format support flag.
     bool dxtTextureSupport_;
+    /// ETC1 format support flag.
+    bool etcTextureSupport_;
     /// Number of primitives this frame.
     unsigned numPrimitives_;
     /// Number of batches this frame.

+ 9 - 0
Engine/Graphics/OpenGL/OGLGraphicsImpl.h

@@ -37,6 +37,15 @@
 #include <GLee.h>
 #endif
 
+#ifdef GL_ES_VERSION_2_0
+#ifndef GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
+#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83f1
+#endif
+#ifndef GL_ETC1_RGB8_OES
+#define GL_ETC1_RGB8_OES 0x8d64
+#endif
+#endif
+
 #include <SDL.h>
 
 class Context;