[osg-users] Mesh Functionality

Robert Osfield robert.osfield at gmail.com
Tue Sep 27 09:18:58 PDT 2016


HI Mike,

On 27 September 2016 at 17:14, Mike Raider <miketimmons at gmail.com> wrote:
> I am working with a mesh and would like to turn off color bleed from one face to the next face.  I want each face to be a solid color.
>
> Sorry for the basic question...

Are you simply looking for OpenGL smooth vs flat shading?

The OSG has a osg::ShadeModel state attribute that wraps up
glShadeModel.  Often you'll find OpenGL features wrapped up with a 1:1
mapping so just replaced the gl by an osg:: and often you'll find what
you are looking for.

To enable flat shading, above the subgraph you want to affect simple add:

   node->getOrCreateStateSet()->setAttribute(new
osg::ShapeModel(osg::ShadeModel::FLAT));

Robert



More information about the osg-users mailing list