View Single Post
Old 19th February 2018, 18:13   #9
Major Dude
Join Date: Mar 2008
Location: Erlangen
Posts: 926
tex2D(uv, some_texture) is a function, and "samples" some_texture at point uv.
uv has a x- and y- coordinate uv.x and uv.y.
Both are floating point numbers between 0...1.
So uv contains 2 floating point numbers and is therefore of type "float2". A "point" in x-y-coordinates.
The shader works on all pixels at the same time. What happens when you define

ret = tex2D(sampler_dancer1,uv);

is that the shader "samples" the texture sampler_dancer.jpg at each x,y coordinate between (0;0) and (1;1) at the same time and throws the result to the screen (which is "ret").

More precisely not each coordinate, because the number of possible coordinates would be infinite, but each pixel. On a 1024 x 1280 screen, this would be 1.310.710 pixels.
Nitorami is offline   Reply With Quote