[osg-users] Setting alpha channel in Frag Shader does not work.

Steven Powers StevenAPowers at gmail.com
Thu Mar 19 07:58:41 PDT 2009

I noticed something else that is interesting... 

When I use the following shader code:

gl_FragColor = vec4(vVertPos.xyz , 1);
(where vVertPos.xyz is the calculated 3D position) 

I get an accurate point cloud of the 3D points that matches up with the geometry of the scene perfectly.

When I use this shader code:

float depth = gl_FragCoord.z / gl_FragCoord.w;
gl_FragColor = vec4(vVertPos.xyz , depth);

I get what looks like the same point cloud but it is scaled up in every direction. Does this ring any bells for anyone?

Read this topic online here:

More information about the osg-users mailing list