View Full Version : GLSL screen boundary question

04-29-2007, 01:01 PM
This is my first post on this forum so I will start with a 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.

-Crash Gordon

04-29-2007, 01:35 PM
If you need the viewport size, pass it as uniform to the shader...
Remember that a fragment shader can't access to other fragments.