GLSL built-in function
textureProj()
Performs projected texture lookup in ES 3.00.
Demo version: GLSL ES 3.00 / WebGL 2Demo stage: Fragment
Syntax
gvec4 textureProj(gsampler2D sampler, vec3 coord)Parameters
- sampler
- Bound fixture texture
- coord
- Lookup coordinate
Return value
Four filtered components after projective division of the texture coordinates by the last supplied component.
Live example
Edit the code and the preview updates as you type.
What textureProj does
Performs projected texture lookup in ES 3.00.
Read the preview
Dividing vec3(uv,0.7) by its last component expands the effective UV range beyond 1. Change 0.7 to 1.0 to restore the complete grid without the clamped right and top areas.
Core call
textureProj(u_texture,vec3(uv,0.7)).rgb;
Keep q nonzero; vec4 coordinates use w as the projection divisor.
Experiment
Try vec3(uv,2.0) in textureProj. The effective coordinates cover only half of each texture axis, enlarging the lower-left quarter of the fixture.