Skip to main content
added 58 characters in body
Source Link
TomSawyer
  • 243
  • 3
  • 9

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;

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'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;

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;
deleted 4 characters in body
Source Link
TomSawyer
  • 243
  • 3
  • 9

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 tutoriasltutorias with sample code to draw at center is 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'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;

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 tutoriasl with sample code to draw at center is 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'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;

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'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;
added 198 characters in body
Source Link
TomSawyer
  • 243
  • 3
  • 9

I'm beginning with shader. I wonderingwonder 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 tutoriasl with sample code to draw at center is 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.

What are differences between apply shader to childFinally, how's about texture2D?

I've applied this code on the node and parent nodeit prints out the whole screen with stretch version / entire scene?(resolution = device resolution)

vec2 xy = gl_FragCoord.xy / resolution.xy;
vec4 texColor = texture2D(CC_Texture0,xy);
gl_FragColor = texColor;

I'm beginning with shader. I wondering 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 tutoriasl with sample code to draw at center is 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.

What are differences between apply shader to child node and parent node / entire scene?

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 tutoriasl with sample code to draw at center is 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'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;
Source Link
TomSawyer
  • 243
  • 3
  • 9
Loading