diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 64bde359a9..cd821a60c4 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -7641,6 +7641,8 @@ get_internal_image_format(Texture *tex) const { #ifndef OPENGLES_1 if (tex->get_component_type() == Texture::T_float) { return GL_RGBA16F; + } else if (tex->get_component_type() == Texture::T_unsigned_short) { + return GL_RGBA16; } else #endif { @@ -7663,7 +7665,11 @@ get_internal_image_format(Texture *tex) const { #endif // OPENGLES #ifndef OPENGLES_1 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: return GL_RGBA32F; #endif // OPENGLES @@ -7747,10 +7753,20 @@ get_internal_image_format(Texture *tex) const { case Texture::F_alpha: return GL_ALPHA; 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_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 case Texture::F_srgb: @@ -10947,6 +10963,9 @@ do_extract_texture_data(CLP(TextureContext) *gtc) { case GL_RGB12: format = Texture::F_rgb12; break; + case GL_RGBA16: + format = Texture::F_rgba16; + break; case GL_R3_G3_B2: format = Texture::F_rgb332; break; @@ -11030,10 +11049,13 @@ do_extract_texture_data(CLP(TextureContext) *gtc) { format = Texture::F_alpha; break; case GL_LUMINANCE: + case GL_LUMINANCE16: + case GL_LUMINANCE16F_ARB: case 1: format = Texture::F_luminance; break; case GL_LUMINANCE_ALPHA: + case GL_LUMINANCE_ALPHA16F_ARB: case 2: format = Texture::F_luminance_alpha; break;