[osg-users] EXTERNAL: Re: Help on multitexturing..

Robert Osfield robert.osfield at gmail.com
Fri Apr 20 00:05:30 PDT 2018


On 19 April 2018 at 20:30, Rowley, Marlin R <marlin.r.rowley at lmco.com>
wrote:

> I thought the sampler value was a pointer to a texture?
>
>
Where did you get that idea?  None of the OSG example attempt this.  When
using OpenGL you pass the sampler uniforms as int, when it comes to OpenGL
the OSG is just a lightweight wrapper around it.



>
> I set the texture unit to 1 because we’ll need the base texture unit 0
> later on.  My goal is to turn on up to 10 texture units and blend them all
> together.
>
>
>
> To be more clear, he is some more code:
>
>
>
> mGroupState = mBoundGeometry->getOrCreateStateSet();
>
>       mGroupState->getOrCreateUniform("BaseTexSampler", osg::Uniform::
> SAMPLER_2D)->set(mBaseColor.get());
>
>       mGroupState->getOrCreateUniform("BaseWeight", osg::Uniform::FLOAT)->
> set(mBaseWeight);
>
>       mGroupState->setTextureAttributeAndModes(BASE_TEXTURE_UNIT,
> mBaseColor, osg::StateAttribute::ON);
>
>
>
> This sets the base texture unit 1 to be bound to the mBaseColor (which is
> a osg::ref_ptr<osg::Texture2D>) created before the function call.
>
>
I tell you want the problem is and you copy and paste more code with that
exact problem in.  Pass in an int value for the sampler texture unit, so
BASE_TEXTURE_UNIT, not the texture pointer.

For future reference, could you refrrame from using this black and white
blocks, it's painful to look at.  Just putting everything in plain texture
but using indentation for code is perfectly fine.

Robert.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20180420/455ff054/attachment.html>


More information about the osg-users mailing list