HI Daniel,
The aliasing of gl_* uniforms to osg_* equivialants is not done by
default. You can switch it one yourself if required though via osg::State,
from the osgsimplegl3 example:
// for non GL3/GL4 and non GLES2 platforms we need enable the osg_
uniforms that the shaders will use,
// you don't need thse two lines on GL3/GL4 and GLES2 specific builds
as these will be enable by default.
gc->getState()->setUseModelViewAndProjectionUniforms(true);
gc->getState()->setUseVertexAttributeAliasing(true);
In your own shaders if you are building against GL1/2 (default build of
OSG) then you can simply use the gl_* parameters.
Also have a look at the shaders in OpenSceneGraph-Data and the osgshaders
example.
Robert.
On 10 October 2014 19:08, Daniel Lobo <[email protected]> wrote:
> 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
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org