[osg-users] gl_/osg_Vertex and gl_/osg_ModelViewProjectionMatrix difference?

Fred Smith osgforum at tevs.eu
Thu Apr 14 00:31:45 PDT 2011


Hi,

I must have been staying too long in front of my computer lately...
The following code works fine:


Code:
// GLSL
out vec4 out_color;

void main(void)
{
	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
	out_color = gl_Color;
}

// Trivial fragment shader code omitted here for clarity



The following code also works fine:


Code:
// C++

setUseModelViewAndProjectionUniforms(true);
setUseVertexAttributeAliasing(true);

// GLSL

uniform mat4 osg_ModelViewProjectionMatrix;
in vec4 osg_Vertex;
in vec4 osg_Color;

out vec4 out_color;

void main(void)
{
	gl_Position = osg_ModelViewProjectionMatrix * osg_Vertex;
	out_color = osg_Color;
}



The following code does not work. Nothing is displayed on my screen:


Code:
// C++

setUseModelViewAndProjectionUniforms(true);

// GLSL

uniform mat4 osg_ModelViewProjectionMatrix;

out vec4 out_color;

void main(void)
{
	gl_Position = osg_ModelViewProjectionMatrix * gl_Vertex;
	out_color = gl_Color;
}



Why? Is there a difference between gl_Vertex/osg_Vertex and gl_ModelViewProjectionMatrix/osg_ModelViewProjectionMatrix?

Cheers,
Fred

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=38455#38455








More information about the osg-users mailing list