Discussion:
[Opensg-users] Shader gl_Color is wrong
Victor Haefner
2014-11-08 18:43:19 UTC
Permalink
Hi,

I have a small problem on my
AMD Radeon HD 7500M/7600M

- using colors per vertex works without shader
- using colors per vertex and a shader accessing them with gl_Color works
in older OpenSG 2
- the variable gl_Color in the vertex shader is black with the newest
version of OpenSG 2

on nvidia I have no problems.

the shader is a simple pass through shader

#version 120
void main( void ) {
gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex;
gl_FrontColor = gl_Color;
}

#version 120
GLSL(
void main( void ) {
gl_FragColor = gl_Color;
}

but the problem applies to all my shaders accessing the color

What information can I provide here to help find the issue?
I tried gdebugger but it does not run on that system because of some
library bug, I will look into it.

Best regards,
Victor
Carsten Neumann
2014-11-10 08:35:36 UTC
Permalink
Hello Victor,
Post by Victor Haefner
I have a small problem on my
AMD Radeon HD 7500M/7600M
- using colors per vertex works without shader
- using colors per vertex and a shader accessing them with gl_Color
works in older OpenSG 2
- the variable gl_Color in the vertex shader is black with the newest
version of OpenSG 2
on nvidia I have no problems.
the shader is a simple pass through shader
#version 120
void main( void ) {
gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex;
gl_FrontColor = gl_Color;
}
#version 120
GLSL(
void main( void ) {
gl_FragColor = gl_Color;
}
but the problem applies to all my shaders accessing the color
hmm, sounds like it could be a problem with aliasing of the built-in
attributes and generic (user defined) attributes. IIRC nvidia aliases
generic attribute 0 with gl_Vertex and some other number with gl_Color
etc. - other vendors don't do that.
Post by Victor Haefner
What information can I provide here to help find the issue?
I tried gdebugger but it does not run on that system because of some
library bug, I will look into it.
Can you try setting geo->setUseAttribCalls(true) on the relevant Geometry?
It would be helpful to know which code path in Geometry::drawPrimitives
you hit (there is big 3 case if statement at the bottom of it) and if
you make any changes to the fields Geometry::_sfUseVao or
GeoProperty::_sfUsevbo from their defaults?

Cheers,
Carsten

------------------------------------------------------------------------------
Victor Haefner
2014-11-10 23:00:21 UTC
Permalink
Hi Carsten,
Post by Carsten Neumann
Can you try setting geo->setUseAttribCalls(true) on the relevant Geometry?
done, also tried setUseVAO, no changes.
Post by Carsten Neumann
It would be helpful to know which code path in Geometry::drawPrimitives
you hit (there is big 3 case if statement at the bottom of it)
I will try to check that, but may take a bit more time.
Post by Carsten Neumann
you make any changes to the fields Geometry::_sfUseVao or
GeoProperty::_sfUsevbo from their defaults?
I didn't touch those.

best regards,
Victor

Loading...