From 60750e840c15a73d55d145feeae35cfed64e79a6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 18 Mar 2012 10:13:04 +0000 Subject: [PATCH] Add a disabled hack to force interpreting depth buffers as RGBA. In order to visualize full dynamic range, until we have something better in place. --- glstate.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/glstate.cpp b/glstate.cpp index 55f3631..5c82182 100644 --- a/glstate.cpp +++ b/glstate.cpp @@ -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(); -- 2.7.4