View Full Version : Some trick to see values in GLSL(debugging) ?
11-10-2011, 06:34 AM
I wonder if is there some way to see what is the the specific calculated or read variable value inside GLSL function?
How do you usually deal with debugging more sophisticated shaders?
Thanks in advance
11-10-2011, 06:50 AM
There's two methods I normally use:
1) Assign the variable to gl_FragColor, scaling if necessary to ensure the range is 0..1, and visually inspect the results. If this fails...
2) Create an FBO with a high-bit depth format (like RGBA32F) and again assign the variable to gl_FragColor. I then read the pixels back, and either print the results to stdout, or and write out the data as an HDR image (like a TIFF or EXR). You'll need a image viewer that can inspect pixel values and support HDR images for the latter.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.