GLSL built-in function
texture2DLod()
Selects an explicit 2D mip level in an ES 1.00 vertex shader.
Syntax
vec4 texture2DLod(sampler2D sampler, vec2 coord, float lod)Parameters
- sampler
- Bound fixture texture
- coord
- Lookup coordinate
- lod
- Mip level; zero is full resolution
Return value
A vec4 sampled at the explicit 2D mip level in a vertex shader, using the texture's filtering settings.
Live example
Edit the code and the preview updates as you type.
What texture2DLod does
Selects an explicit 2D mip level in an ES 1.00 vertex shader.
Read the preview
The vertex shader samples texture2DLod(u_texture,uv,u_parameter*7.0) only at the quad's vertices, then interpolates their colors. Set the LOD expression to 0.0: the full-resolution grid still cannot appear in the interior because there are no per-fragment lookups.
Core call
texture2DLod(u_texture,uv,u_parameter*7.0).rgb;
This ES 1.00 core name is for vertex shaders; fragment use requires an extension.
Experiment
In the Vertex tab, replace u_parameter*7.0 with 6.0. The corner samples now come from a coarse mip, and their interpolated colors change without adding any grid detail.