问题描述
texturelod 的LOD参数取什么值??我发现的规格根本没有提及.它是百分比还是带有百分比的索引值.如果是后者,是否有办法获取纹理具有的mipmap的数量,以便我可以使用一个百分比?
What value does the LOD parameter take for texturelod? The spec I found doesn't mention it at all. Is it a percentage or an index value with a percent. If the later is the case, is there a way to get the number of mipmaps the texture has so that I would be able to use a percentage?
推荐答案
LOD参数指定mipmap级别,四舍五入到最接近的整数.请记住,OpenGL指定了mipmap级别,例如0表示最大,而数字越小.
The LOD parameter specifies the mipmap level, rounded to the nearest whole number. Remember that OpenGL specifies mipmap levels, such that 0 is the largest, with increasing numbers going smaller.
但是,此处指定的LOD总是 相对于当前 GL_TEXTURE_BASE_LEVEL
纹理.因此,如果您使用 textureLod(...,0)
,并且基本级别设置为mipmap 2,则将从mipmap级别2中进行选择.您也不能在之外选择mipmap.GL_TEXTURE_MAX_LEVEL
范围;系统将自动适当钳位指定的参数.
However, the LOD specified here will always be relative to the current GL_TEXTURE_BASE_LEVEL
of the texture. So if you use textureLod(..., 0)
, and the base level is set to mipmap 2, then you will select from mipmap level 2. You also cannot select mipmaps outside of the GL_TEXTURE_MAX_LEVEL
range; the system will automatically clamp the specified parameter appropriately.
这篇关于着色器TextureLod参数值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!