changeset 34973:7a51bcd28fd1

Query correct component to get luminance texture bit depth and sanity-check result.
author reimar
date Thu, 09 Aug 2012 18:49:45 +0000
parents 445009e9ee8d
children 69eda178551e
files libvo/gl_common.c libvo/gl_common.h
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/gl_common.c	Wed Aug 08 19:18:02 2012 +0000
+++ b/libvo/gl_common.c	Thu Aug 09 18:49:45 2012 +0000
@@ -573,9 +573,9 @@
   mpglTexImage2D(target, 0, fmt, w, h, 0, format, type, init);
   if (format == GL_LUMINANCE && type == GL_UNSIGNED_SHORT) {
     // ensure we get enough bits
-    GLint rs = 16;
-    glGetTexLevelParameteriv(target, 0, GL_TEXTURE_RED_SIZE, &rs);
-    use_depth_l16 = rs < 14;
+    GLint bits = 0;
+    glGetTexLevelParameteriv(target, 0, GL_TEXTURE_LUMINANCE_SIZE, &bits);
+    use_depth_l16 = bits > 0 && bits < 14;
     if (use_depth_l16) {
       fmt = GL_DEPTH_COMPONENT16;
       format = GL_DEPTH_COMPONENT;
--- a/libvo/gl_common.h	Wed Aug 08 19:18:02 2012 +0000
+++ b/libvo/gl_common.h	Thu Aug 09 18:49:45 2012 +0000
@@ -275,8 +275,8 @@
 #ifndef GL_DEPTH_COMPONENT16
 #define GL_DEPTH_COMPONENT16 0x81A5
 #endif
-#ifndef GL_TEXTURE_RED_SIZE
-#define GL_TEXTURE_RED_SIZE 0x805C
+#ifndef GL_TEXTURE_LUMINANCE_SIZE
+#define GL_TEXTURE_LUMINANCE_SIZE 0x8060
 #endif
 #ifndef GL_DEPTH_TEXTURE_MODE
 #define GL_DEPTH_TEXTURE_MODE 0x884B