Hi all,

I am trying to draw an osg scene (lz.osg) with shaders. For that, I had to use 
the Visitor Pattern and so on. The problem that I am having is that I don't 
know how the texture coordinates are beeing uploaded to shaders. I was 
expecting that I could use osg_MultiTexCoord0 in a similar way than osg_Vertex, 
but it seems that doesn't work.


Here is my shader code.

Vertex shader:


Code:

#version 400

uniform mat4 osg_ModelViewProjectionMatrix;
in vec4 osg_Vertex;
in vec4 osg_MultiTexCoord0;

out vec2 texCoord;

void main()
{
texCoord = osg_MultiTexCoord0.st;
gl_Position = osg_ModelViewProjectionMatrix * osg_Vertex;
}





Fragment shader:


Code:

#version 400

out vec4 outColor;
uniform sampler2D baseMap;
in vec2 texCoord;

void main()
{
outColor = texture(baseMap, texCoord);
}




Thank you!
Best wishes

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





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to