@stevetranby okay i tried setting coordinates manually ,
Added screenshot sample of {100,100} test case
with FIXED_WIDTH:
Hero’s coordinate {0,0} - Shader’s coordinate {0,0} -> They both were overlapping however only 1/4 of circle (of both of them) was visible to me as rest went out of the view.
Hero’s coordinate {0,100} - Shader’s coordinate {0,100} -> Perfectly Overlapping
Hero’s coordinate {100,0} - Shader’s coordinate {100,0} -> Perfectly Overlapping
Hero’s coordinate {100,100} - Shader’s coordinate {100,100} -> Perfectly Overlapping
with FIXED_HEIGHT:
Hero’s coordinate {0,0} - Shader’s coordinate {0,0} -> Only 1/4 of circle (of both of them) was visible to me as rest went out of the view so cant say if they were perfectly overlapping or not
Hero’s coordinate {0,100} - Shader’s coordinate {0,100} -> Did not overlap
Hero’s coordinate {100,0} - Shader’s coordinate {100,0} -> Did not overlap
Hero’s coordinate {100,100} - Shader’s coordinate {100,100} -> Did not overlap
ShaderLayer->setCirclePosition(pos) just takes pos and update uniform vec2 position with argument pos
My shader is also simple nothing complex, here is my fragment shader code and vertex shader i already pasted on top of this thread.
varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
uniform vec2 position;
uniform float lightSize;
void main()
{
float abs;
float darkness = 0.9;
vec4 diffuseColor = texture2D(CC_Texture0,v_texCoord);
gl_FragColor = vec4(vec3(gl_FragColor.xyz), 0.9);
vec2 centerPos = gl_FragCoord.xy - vec2(position.x, position.y);
//calculate light density
float z = sqrt(lightSize*lightSize - centerPos.x*centerPos.x - centerPos.y*centerPos.y);
z /= lightSize;
if (length(centerPos) < lightSize) {
abs = darkness - z;
gl_FragColor = v_fragmentColor * vec4(255.0, 255.0, 51.0, 0.4*255.0)/255.0;
}
}
I’m also attaching the screenshots of how things vary for me (red ball is hero)
FIXED_HEIGHT

Default or FIXED_WIDTH
