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

Rowley, Marlin R marlin.r.rowley at lmco.com
Mon Apr 23 09:29:23 PDT 2018

Thanks Robert.  I got it working and will do text only for code in the future.


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg at 01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.rowley at lmco.com<mailto:marlin.r.rowley at lmco.com>

From: osg-users [mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Robert Osfield
Sent: Friday, April 20, 2018 2:06 AM
To: OpenSceneGraph Users <osg-users at lists.openscenegraph.org>
Subject: EXTERNAL: Re: [osg-users] EXTERNAL: Re: Help on multitexturing..

On 19 April 2018 at 20:30, Rowley, Marlin R <marlin.r.rowley at lmco.com<mailto: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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20180423/621fe98f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 3114 bytes
Desc: image001.jpg
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20180423/621fe98f/attachment.jpg>

More information about the osg-users mailing list