Browse Source

support GL_RGBA16, GL_LUMINANCE16, GL_LUMINANCE_ALPHA16 etc.

David Rose 11 years ago
parent
commit
7bce2d6124
1 changed files with 25 additions and 3 deletions
  1. 25 3
      panda/src/glstuff/glGraphicsStateGuardian_src.cxx

+ 25 - 3
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -7641,6 +7641,8 @@ get_internal_image_format(Texture *tex) const {
 #ifndef OPENGLES_1
 #ifndef OPENGLES_1
     if (tex->get_component_type() == Texture::T_float) {
     if (tex->get_component_type() == Texture::T_float) {
       return GL_RGBA16F;
       return GL_RGBA16F;
+    } else if (tex->get_component_type() == Texture::T_unsigned_short) {
+      return GL_RGBA16;
     } else
     } else
 #endif
 #endif
     {
     {
@@ -7663,7 +7665,11 @@ get_internal_image_format(Texture *tex) const {
 #endif  // OPENGLES
 #endif  // OPENGLES
 #ifndef OPENGLES_1
 #ifndef OPENGLES_1
   case Texture::F_rgba16:
   case Texture::F_rgba16:
-    return GL_RGBA16F;
+    if (tex->get_component_type() == Texture::T_float) {
+      return GL_RGBA16F;
+    } else {
+      return GL_RGBA16;
+    }
   case Texture::F_rgba32:
   case Texture::F_rgba32:
     return GL_RGBA32F;
     return GL_RGBA32F;
 #endif  // OPENGLES
 #endif  // OPENGLES
@@ -7747,10 +7753,20 @@ get_internal_image_format(Texture *tex) const {
   case Texture::F_alpha:
   case Texture::F_alpha:
     return GL_ALPHA;
     return GL_ALPHA;
   case Texture::F_luminance:
   case Texture::F_luminance:
-    return GL_LUMINANCE;
+    if (tex->get_component_type() == Texture::T_float) {
+      return GL_LUMINANCE16F_ARB;
+    } else if (tex->get_component_type() == Texture::T_unsigned_short) {
+      return GL_LUMINANCE16;
+    } else {
+      return GL_LUMINANCE;
+    }
   case Texture::F_luminance_alpha:
   case Texture::F_luminance_alpha:
   case Texture::F_luminance_alphamask:
   case Texture::F_luminance_alphamask:
-    return GL_LUMINANCE_ALPHA;
+    if (tex->get_component_type() == Texture::T_float || tex->get_component_type() == Texture::T_unsigned_short) {
+      return GL_LUMINANCE_ALPHA16F_ARB;
+    } else {
+      return GL_LUMINANCE_ALPHA;
+    }
 
 
 #ifndef OPENGLES_1
 #ifndef OPENGLES_1
   case Texture::F_srgb:
   case Texture::F_srgb:
@@ -10947,6 +10963,9 @@ do_extract_texture_data(CLP(TextureContext) *gtc) {
   case GL_RGB12:
   case GL_RGB12:
     format = Texture::F_rgb12;
     format = Texture::F_rgb12;
     break;
     break;
+  case GL_RGBA16:
+    format = Texture::F_rgba16;
+    break;
   case GL_R3_G3_B2:
   case GL_R3_G3_B2:
     format = Texture::F_rgb332;
     format = Texture::F_rgb332;
     break;
     break;
@@ -11030,10 +11049,13 @@ do_extract_texture_data(CLP(TextureContext) *gtc) {
     format = Texture::F_alpha;
     format = Texture::F_alpha;
     break;
     break;
   case GL_LUMINANCE:
   case GL_LUMINANCE:
+  case GL_LUMINANCE16:
+  case GL_LUMINANCE16F_ARB:
   case 1:
   case 1:
     format = Texture::F_luminance;
     format = Texture::F_luminance;
     break;
     break;
   case GL_LUMINANCE_ALPHA:
   case GL_LUMINANCE_ALPHA:
+  case GL_LUMINANCE_ALPHA16F_ARB:
   case 2:
   case 2:
     format = Texture::F_luminance_alpha;
     format = Texture::F_luminance_alpha;
     break;
     break;