louiselessel / Touchdesigner-tools

Small touchdesigner help tools
15 stars 0 forks source link

TD: does not operate on 'vec4' and 'vec2 #2

Closed louiselessel closed 4 years ago

louiselessel commented 4 years ago

Original: vec2 p = (2.0fragCoord-iResolution.xy)/iResolution.y; Becomes: vec2 p = (2.0gl_fragCoord-iResolution.xy)/iResolution.y; Should be: vec2 p = (2.0*fragCoord.xy-iResolution.xy)/iResolution.y;

ERROR MSG: Pixel Shader Compile Results: ERROR: 0:88: '-' does not operate on 'vec4' and 'vec2' ERROR: 0:92: Use of undeclared identifier 'p' ERROR: 0:95: Use of undeclared identifier 'f' ERROR: 0:99: Use of undeclared identifier 'f' ERROR: 0:107: Use of undeclared identifier 'p' ERROR: 0:107: Use of undeclared identifier 'f' ERROR: 0:109: Use of undeclared identifier 'p' ERROR: 0:109: Use of undeclared identifier 'f'

Bug 1
louiselessel commented 4 years ago

Fixed with replaces:

s_edit = s_edit.replace('fragCoord.xy', 'gl_FragCoord.xy')
s_edit = s_edit.replace('fragCoord', 'gl_FragCoord.xy')

## fix special case errors - as I come across them, see github repo issues
s_edit = s_edit.replace('gl_FragCoord.xy.xy', 'gl_FragCoord.xy')     # make sure it didnt add .xy double.