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?
textureLod performs a texture lookup at coordinate P from the texture bound to sampler with an explicit level-of-detail as specified in lod .
Shader stages: A sampler is a set of GLSL variable types. Variables of one of the sampler types must be uniforms or as function parameters. Each sampler in a program represents a single texture of a particular texture type. The type of the sampler corresponds to the type of the texture that can be used by that sampler.
gl_FragColor is the principal variable that your fragment shader is designed to change. If your code does not assign a value to it then it is left undefined for the rest of the pipeline. gl_FragData is an array of data that can be used by the rest of the pipeline.
A sampler2D is used to do lookup in a standard texture image; a samplerCube is used to do lookup in a cubemap texture (Subsection 5.3. 4). The value of a sampler variable is a reference to a texture unit. The value tells which texture unit is invoked when the sampler variable is used to do texture lookup.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With