[osg-users] How to use more than 4 texture units?
Farshid Lashkari
flashk at gmail.com
Wed Jun 17 10:58:23 PDT 2015
Hi Jannik,
I suspect your driver only supports 4 texture units using the fixed
function. Check the GL_MAX_TEXTURE_UNITS value to verify:
GLint units;
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &units);
My GeForce GTX 760 only supports 4 fixed function texture units, but up to
32 units using the shader pipeline. Are you sure the non-OSG based app was
using the fixed function pipeline?
Cheers,
Farshid
On Wed, Jun 17, 2015 at 10:47 AM, Jannik Heller <scrawl at baseoftrash.de>
wrote:
> Oops, posted wrong code - that should have been 4 instead of 3, of course.
>
>
> Code:
>
> diff --git a/examples/osgbillboard/osgbillboard.cpp
> b/examples/osgbillboard/osgbillboard.cpp
> index a6243e8..64f893c 100644
> --- a/examples/osgbillboard/osgbillboard.cpp
> +++ b/examples/osgbillboard/osgbillboard.cpp
> @@ -67,7 +67,7 @@ osg::Drawable* createSquare(const osg::Vec3&
> corner,const osg::Vec3& width,const
> (*tcoords)[1].set(1.0f,0.0f);
> (*tcoords)[2].set(1.0f,1.0f);
> (*tcoords)[3].set(0.0f,1.0f);
> - geom->setTexCoordArray(0,tcoords);
> + geom->setTexCoordArray(4,tcoords);
>
> geom->addPrimitiveSet(new
> osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
>
> @@ -76,7 +76,7 @@ osg::Drawable* createSquare(const osg::Vec3&
> corner,const osg::Vec3& width,const
> osg::StateSet* stateset = new osg::StateSet;
> osg::Texture2D* texture = new osg::Texture2D;
> texture->setImage(image);
> -
> stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
> +
> stateset->setTextureAttributeAndModes(4,texture,osg::StateAttribute::ON);
> geom->setStateSet(stateset);
> }
>
>
>
>
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=64112#64112
>
>
>
>
>
> _______________________________________________
> 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/20150617/b9728ced/attachment-0003.htm>
More information about the osg-users
mailing list