GLSL screen boundary question

This is my first post on this forum so I will start with a hello.

Hello!

Phew, now that I’m done with that here is my problem.

I am a beginner with GLSL so I’m still a little unsure about how to get certain bits of information. I need to find out the boundaries for the edges of the screen, so if a window is 800x600 I need to get that x and y value. So far I am using

float x = gl_FragCoord.x;
float y = gl_FragCoord.y;

to check the current fragments position.

Is there a way to get the max of gl_FragCoord or another way to find those values.

Also I want to mention that I need to get these values inside the shader, so I can’t just pass the resolution via a uniform value.

The effect I am going for is faded edges on the screen.

Thanks
-Crash Gordon

If you need the viewport size, pass it as uniform to the shader…
Remember that a fragment shader can’t access to other fragments.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.