Setting color to Polygon element

Jul 11, 2012 at 11:21 AM

Hi Guys,

Can somebody help me to set the color of a Polygon element when using the scene graph?

I am guessing that I need to use effects, but I cannot get it to work. My current code looks like this:

//----------------------

Polygon = new SharpGL.SceneGraph.Primitives.Polygon();
OpenGLAttributesEffect glEffect = new OpenGLAttributesEffect();
GLColor glClr = new GLColor(Color[0] / 255.0f, Color[1] / 255.0f,  Color[2] / 255.0f,  Color[3] / 255.0f);

glEffect.ColorBufferAttributes.ColorModeClearColor = glClr;
glEffect.ColorBufferAttributes.ColorModeWriteMask = glClr;

Polygon.AddEffect(glEffect);

//----------------------

This seems to have no effect... I didn't find any sample to achieve that, can you please give me any hint.

Thanks.

Coordinator
Jul 12, 2012 at 7:39 AM

Have you got lighting enabled? Setting the colour will have no effect if you are using lighting, you'll have to set the material instead. I'm hoping to write a sample on this but really short on free time :S