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

Glenn Waldron gwaldron at gmail.com
Thu Dec 22 07:57:32 PST 2016


Ekaterina,

The model you are loading has a lot of state in it, like blending,
textures, etc. When you use a shader to render it, your shader needs to
support all the things that OSG would otherwise render using the GL
fixed-function pipeline. For example, the texture does not show up because
your shader does not sample it anywhere.

So you will need to build a shader program that combines the features in
the model with your projective texturing. You might start by looking at the
osgUtil::ShaderGen class for some hints, or by running that visitor on your
model and then dumping out the source and editing it.

Good luck.

Glenn Waldron

On Thu, Dec 22, 2016 at 10:27 AM, Christian Buchner <
christian.buchner at gmail.com> wrote:

> Just some wild guesses:
>
> You might have to enable blending in the state set, and set an appropriate
> blend function as (depending on whether your projective texturing is done
> in a 2nd render pass or not)
>
> On hardware that does not support opengl border colors
> (ARB_texture_border_clamp) in hardware, you might have to explicitly set
> the texture's border pixels to a transparent color, turning a 512x512 image
> into effectively a 510x510 one.
>
> Christian
>
>
> 2016-12-22 16:03 GMT+01:00 Ekaterina Fokina <ekaterina.fokina at tum.de>:
>
>> Thank you your answers!
>>
>> Attached there is a printscreen what I get.
>> For the terrain I am using lz.osgt and the image for the texture file is
>> osg128.png.
>>
>> I set the border to transparent, but unfortunatelly it didn´t help...
>>
>> Guys, could you please give me a hint how is it possible to relocate the
>> projected image on the terrain to a specific location on that terrain?
>> I am still confused how to set the texture coordinats uning shaders.
>>
>> Thank you!
>>
>> Cheers,
>> Ekaterina
>>
>> ------------------
>> Read this topic online here:
>> http://forum.openscenegraph.org/viewtopic.php?p=69738#69738
>>
>>
>>
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
> _______________________________________________
> 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/20161222/15537899/attachment-0003.htm>


More information about the osg-users mailing list