I want to add that this is the fragment shader I used for drawing the wireframe
model
Code:
precision highp float;
varying vec3 vBC;
#extension GL_OES_standard_derivatives : enable
float edgeFactor(){
vec3 d = fwidth(vBC);
vec3 a3 = smoothstep(vec3(0.0), d*1.0, vBC);
return min(min(a3.x, a3.y), a3.z);
}
void main (void)
{
gl_FragColor = vec4(0.0, 0.0, 0.0, (1.0-edgeFactor())*1.0);
}
Special thanks to this blog for the fragment shader and the idea of using
barycentric coordinates!
http://codeflow.org/entries/2012/aug/02/easy-wireframe-display-with-barycentric-coordinates/
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=57117#57117
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org