Hi Robert,

my previous 'solution' was y wrong, because there are other possible modes
being assosiated.

So better  as no Texture modes are associated with textures in OpenGL ES 2.0

to ifndef code in

osg/Texture header file

instead of

 virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const
        {
            usage.usesTextureMode(getTextureTarget());
            return true;
        }

to have

virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const
        {
            #ifndef OSG_GLES2_AVAILABLE
            usage.usesTextureMode(getTextureTarget());
            return true;
            #else
            return false;
            #endif

        }


Regards
Sergey

On Tue, Sep 9, 2014 at 3:27 PM, Sergey Kurdakov <[email protected]>
wrote:

> Hi Alistair,
>
> >in that case was to just use setTextureAttribute
>
> a correct solution,
>
> So possibly a fix for those unaware of this subtle difference to  just
> have in setTextureAttributeAndModes for OpenGL ES 2.0 a similar code as for
> setTextureAttribute
>
> void StateSet::setTextureAttributeAndModes(unsigned int
> unit,StateAttribute *attribute, StateAttribute::GLModeValue value)
> {
>     if (attribute)
>     {
>
>         if (attribute->isTextureAttribute())
>         {
>             if (value&StateAttribute::INHERIT)
>             {
>                 removeTextureAttribute(unit,attribute->getType());
>             }
>             else
>             {
>
> setAttribute(getOrCreateTextureAttributeList(unit),attribute,value);
>                 #ifndef OSG_GLES2_AVAILABLE
>                 setAssociatedTextureModes(unit,attribute,value);
>                 #endif
>             }
>         }
>         else
>         {
>             OSG_NOTICE<<"Warning: non texture attribute
> '"<<attribute->className()<<"' passed to
> setTextureAttributeAndModes(unit,attr,value), "<<std::endl;
>             OSG_NOTICE<<"         assuming
> setAttributeAndModes(attr,value) instead."<<std::endl;
>             OSG_NOTICE<<"         please change calling code to use
> appropriate call."<<std::endl;
>             setAttribute(attribute,value);
>         }
>     }
> }
>
> Regards
> Sergey
>
> On Tue, Sep 9, 2014 at 2:58 PM, Alistair Baxter <[email protected]> wrote:
>
>>    I found the solution in that case was to just use setTextureAttribute
>> rather than setTextureAttributeAndModes in OpenGL ES 2 builds.
>>
>>
>>
>> However, since glEnable(GL_TEXTURE_2D) is a mistake in GLES2, it would be
>> better if osg didn’t ever try to do that for GLES2 contexts.
>>
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to