OpenGL:我应该自己剪辑glColor * f值吗? [英] OpenGL: Should i always clip the glColor*f values myself?
问题描述
这可能听起来很蠢...但我一直在想,如果我发送一个大于1.0f的值到glColor * f函数是否重要?
This may sound stupid... but I've been wondering, does it matter if i send a value greater than 1.0f to the glColor*f functions?
旧gfx卡/驱动程序处理这些不同? OpenGL直接使用我给它的颜色值,还是它自己剪辑?我应该停止做if(r> 1.0f)r = 1.0f; ?是否有任何危险,大于1.0f会导致未指定的行为?
Does older gfx cards/drivers handle these differently? Does OpenGL directly use the color value i give to it, or does it clip it on its own? Should i stop doing if(r > 1.0f) r = 1.0f; ? Is there any danger the greater than 1.0f would result in unexpeceted behaviour?
我似乎没有大于1.0f做任何不同的事情。
I cant seem to get greater than 1.0f to do anything different.
推荐答案
从联机帮助页:
在更新当前颜色之前,浮点数或有符号整数值都不会被锁定到范围[0,1]在它们被内插或写入颜色缓冲器之前被钳位到该范围。
"Neither floating-point nor signed integer values are clamped to the range [0,1] before the current color is updated. However, color components are clamped to this range before they are interpolated or written into a color buffer."
这篇关于OpenGL:我应该自己剪辑glColor * f值吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!