Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / 3D Theory & Graphics / Finding screen space coordinates with GLSL? Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

April 04, 2005, 06:45 PM


I know in PS3.0 cards you can directly access the screen space coordinates within fragment shaders, something like screenPos.xy

My question is, is it possible to do this without PS3.0 support? And specificly using GLSL?



April 04, 2005, 06:55 PM

Yes, there is a read-only variable gl_FragCoord, which is a vec4 whose x,y components are the fragment's window coordinates.


April 04, 2005, 07:04 PM

Wohoo thanks dude. Nice and simple...i really musn't have looked hard enough. Googling for "GLSL screen space coordinatess" gave me nothing useful. Thanks!

This thread contains 3 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.