I'm beginning with shader. I wonder what if i apply shader for single node, what'll happen?
The gl_FragCoord = (0.5,0.5) is the bottom left of the screen or the bottom left of the node?
I get some wrong caculations while wanting to draw something in the center of the node (not the screen).
Many shader tutorias with sample code to draw at center using gl_FragCoord.xy / resolution.xy, if it's 0.5, it's center. In this case, it might be wrong because i want to draw in center of the node.
Finally, how's about texture2D i use texture2D instead of texture, are they the same?
I've applied this code on the node and it prints out the whole screen with stretch version (resolution = device resolution)
vec2 xy = gl_FragCoord.xy / resolution.xy;
vec4 texColor = texture2D(CC_Texture0,xy);
gl_FragColor = texColor;
gl_FragCoord.xy / resolution.xyis wrong in this case to get position of pixel on the node? \$\endgroup\$gl_FragCoord.xy / resolution.xyis the center of the viewport (assuming thatresolutionis the viewport resolution like it is in ShaderToy). To get the center of the node you need to either pass the node's coordinates into the shader and calculate the screen pixels from that or do the calculation CPU side and pass the coordinates into the shader \$\endgroup\$