Hi Shuiying,
The fragments coordinates(or index as you call it) can be accessed via
gl_FragCoord. This will give unnormalized device coordinates (i.e.
[0,xRes] [0,yRes]) which are also called window relative coordinates
If you pass your screen resolution as uniform vec2 you can normalize
them to device coordinates easily.
cheers
Sebastian
Hello,
In fragment shader, I would like to chage the fragment colour
according to the fragment's index. Here index means integer number
pair(x,y), where 0<x<xRes, 0<y<yRes, provided that viewPort has xRes *
yRes pixels.
Is there a way to achieve that?
Thank you in advance!
Shuiying
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org