[osg-users] Texture projection on terrain and gl_TextureMatrix[0...7]

Glenn Waldron gwaldron at gmail.com
Wed Dec 21 07:17:05 PST 2016


Ekaterina,
You might try setting your texture border color to transparent.

texture->setBorderColor(osg::Vec4(0,0,0,0));

The index in gl_TextureMatrix[1] is the texture image unit; it should match
the slot you specified in your call to

stateset->setTextureAttributeAndModes(1, texMat, osg::StateAttribute::ON);


Glenn Waldron

On Wed, Dec 21, 2016 at 9:57 AM, Ekaterina Fokina <ekaterina.fokina at tum.de>
wrote:

> Hello,
>
> I am trying to understand how to project a texture on a specific part of
> the terrain. There are many examples how to project a texture on a whole
> object, but not to a part of the oblect. That means the question is how to
> specify texture coordinates (using the shader) on order to project a
> texture on a right place?
>
> I have found an examle in internet:
> http://jotschi.de/2009/05/31/projective-textures-with-openscenegraph/
>
> But unfortunatelly, It is not working properly and I can see my projection
> on the terrain, but the rest of it is black.
>
> One more question, does anybody can explain to me what is the difference
> between the numbers in gl_TextureMatrix[0...7]?
>
>
> Thank you!
>
> Cheers,
> Ekaterina
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=69726#69726
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20161221/aa86cafa/attachment-0003.htm>


More information about the osg-users mailing list