View Full Version : Some trick to see values in GLSL(debugging) ?
11-10-2011, 07: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, 07: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.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.