]> git.cworth.org Git - apitrace/commitdiff
Add a disabled hack to force interpreting depth buffers as RGBA.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sun, 18 Mar 2012 10:13:04 +0000 (10:13 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sun, 18 Mar 2012 10:18:17 +0000 (10:18 +0000)
In order to visualize full dynamic range, until we have something
better in place.

glstate.cpp

index 55f3631b945df3ee3cdd34b3eb8a0151bfe09f9d..5c82182517347305e0235da960b812803486db7c 100644 (file)
@@ -1130,12 +1130,23 @@ dumpReadBufferImage(JSONWriter &json, GLint width, GLint height, GLenum format,
     json.writeBoolMember("__normalized__", true);
     json.writeNumberMember("__channels__", channels);
 
+    GLenum type = GL_UNSIGNED_BYTE;
+
+#if 0
+    /* XXX: Hack to force interpreting depth buffers as RGBA to visualize full
+     * dynamic range, until we can transmit HDR images to the GUI */
+    if (format == GL_DEPTH_COMPONENT) {
+        type = GL_UNSIGNED_INT;
+        channels = 4;
+    }
+#endif
+
     GLubyte *pixels = new GLubyte[width*height*channels];
 
     // TODO: reset imaging state too
     context.resetPixelPackState();
 
-    glReadPixels(0, 0, width, height, format, GL_UNSIGNED_BYTE, pixels);
+    glReadPixels(0, 0, width, height, format, type, pixels);
 
     context.restorePixelPackState();