glsl - Parameters of a function -


so i've been following online tutorial on webgl , i've gotten part "gl_fragcolor = vec4(surfaceposition, 0., 1.)*cos(time); " used . , i've been searching everywhere find 0. , 1. stand for. i'm asking if explain these parameters are? , why have provide position of pixel (surfaceposition) color function?

vec4 constructor need 4 dimension value (which 4 values).

(basically rgba it's color)

so give 2 dimension value surfaceposition (which red , green component), 2 values still needed, represent blue component , transparency component, respectively 0. , 1.

(0 , 1 casted floating point numbers)

that's first question.

for second 1 depends on want do. using position of pixel (in case surfaceposition represent it) directly components in resulting color suggest want color pixels depending on position.

but depends on what's goal, don't "have provide position of pixel", compute final color want.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -