Sfoglia il codice sorgente

glHint for compression

David Rose 17 anni fa
parent
commit
5a6b6d995c
1 ha cambiato i file con 23 aggiunte e 1 eliminazioni
  1. 23 1
      panda/src/glstuff/glGraphicsStateGuardian_src.cxx

+ 23 - 1
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -6990,7 +6990,7 @@ upload_texture(CLP(TextureContext) *gtc, bool force) {
   if (!get_supports_compressed_texture_format(image_compression)) {
     image = tex->get_uncompressed_ram_image();
     image_compression = Texture::CM_off;
-  }    
+  } 
 
   /*
   if (image.is_null()) {
@@ -7067,6 +7067,28 @@ upload_texture(CLP(TextureContext) *gtc, bool force) {
     }
   }
 
+  if (image_compression != Texture::CM_off) {
+    Texture::QualityLevel quality_level = tex->get_quality_level();
+    if (quality_level == Texture::QL_default) {
+      quality_level = texture_quality_level;
+    }
+
+    switch (quality_level) {
+    case Texture::QL_fastest:
+      GLP(Hint)(GL_TEXTURE_COMPRESSION_HINT, GL_FASTEST);
+      break;
+
+    case Texture::QL_default:
+    case Texture::QL_normal:
+      GLP(Hint)(GL_TEXTURE_COMPRESSION_HINT, GL_DONT_CARE);
+      break;
+
+    case Texture::QL_best:
+      GLP(Hint)(GL_TEXTURE_COMPRESSION_HINT, GL_NICEST);
+      break;
+    }
+  }
+
   GLP(PixelStorei)(GL_UNPACK_ALIGNMENT, 1);
 
   bool uses_mipmaps = (tex->uses_mipmaps() && !CLP(ignore_mipmaps)) || CLP(force_mipmaps);