Discussion:
[Opensg-users] disable vertex colors in a material forcing the use of the diffuse color
Victor Haefner
2016-01-15 14:27:14 UTC
Permalink
Hi all,


I have a multipassmaterial to add a selection outline via stencil buffer
etc..
My problem is that when selecting a geometry with vertex colors my
selection outline is not using the diffuse color of my material but the
vertex colors.

Can I disable/ignore the vertex colors through a material option?
If not I think the only way is my own shader, or does anybody have another
idea?


Best regards,
Victor
Carsten Neumann
2016-01-15 16:18:56 UTC
Permalink
Hello Victor,
Post by Victor Haefner
Can I disable/ignore the vertex colors through a material option?
If not I think the only way is my own shader, or does anybody have
another idea?
whether the fixed function pipeline uses vertex colors for lighting
calculations is controlled by glColorMaterial and
glEnable(GL_COLOR_MATERIAL).
You can use a MaterialChunk with sfColorMaterial and sfBackColorMaterial
set to GL_NONE. That will make OpenGL use only the colors in the
material for lighting.
In case you are not using lighting (i.e. glDisable(GL_LIGHTING)) the
fixed function pipeline will use the vertex colors and I don't think we
have a way to _not_ pass vertex attributes that are attached to a
geometry to the GL - so a shader would probably your best (only?) option
in that case.

Cheers,
Carsten
Victor Haefner
2016-01-15 16:40:00 UTC
Permalink
Hello Carsten

thank you very much for the quick reply, I tried it, it is exactly as you
explained, I will have to use a shader.

colChunk = MaterialChunk::create();
colChunk->setColorMaterial(GL_NONE);
colChunk->setBackColorMaterial(GL_NONE);

Best regards,
Victor

On Fri, Jan 15, 2016 at 5:18 PM, Carsten Neumann <
Post by Carsten Neumann
Hello Victor,
Post by Victor Haefner
Can I disable/ignore the vertex colors through a material option?
If not I think the only way is my own shader, or does anybody have
another idea?
whether the fixed function pipeline uses vertex colors for lighting
calculations is controlled by glColorMaterial and
glEnable(GL_COLOR_MATERIAL).
You can use a MaterialChunk with sfColorMaterial and sfBackColorMaterial
set to GL_NONE. That will make OpenGL use only the colors in the
material for lighting.
In case you are not using lighting (i.e. glDisable(GL_LIGHTING)) the
fixed function pipeline will use the vertex colors and I don't think we
have a way to _not_ pass vertex attributes that are attached to a
geometry to the GL - so a shader would probably your best (only?) option
in that case.
Cheers,
Carsten
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Opensg-users mailing list
https://lists.sourceforge.net/lists/listinfo/opensg-users
Loading...