I wrote some simple shader code in CYOS to create a ring outline. I calculated the distance from the center and if greater than a 10, the pixels should change colour. But the colour is remaining constant for 10, and changing it to 600 gives this :
What am I doing wrong? I am new to shaders, so extremely sorry if I’m missing something simple.
gl_FragCoord gives you the coordinates of the fragment currently processed in pixels. So, you will have to compute the distance from the center of the screen given in pixels. However, the screen size depends on the size of the rendering window…
In my case, the rendering window was 1280x1090, so: