[osg-users] transfer data to shader with osg::texture

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Wed Oct 5 01:47:38 PDT 2016


Hi Liu,

Are you getting values between 0 and 1?
Cheers
Sebastian
> thank you for your reply ,I have tried your solution ,But it still is invaild,the Geometry shader can not get original input values.Are there  other wrong in code?Thank you for your help.
>
> SMesserschmidt wrote:
>> Am 10/5/2016 um 3:37 AM schrieb liu ming:
>>
>>> Hi Wojtek ,Thank you for your reply,I have  tried GL_RGBA16F_ARB instead like that "texture0->setInternalFormat(GL_RGBA16F_ARB);",but  it seemed like not valid.The value still is 0..1 range.Are there other solutions? Thank you.
>>>
>> So they are now _between_ 0 and , instead of 0 _or_ 1? Then, at least,
>> you're on the right track.
>> What  seems wrong however is your sampler setup. Try this instead:
>>
>> osg::Uniform* sampler = new osg::Uniform(osg::Uniform::SAMPLER_1D, "data");
>> sampler->set(0); //assign unit
>>
>> ss->addUniform(sampler);
>>
>> ss->setTextureAttribute(0/*unit*/, texture0 ,osg::StateAttribute::ON );
>>
>> Cheers
>> Sebastian
>>
>>
>>
>>
>>> ------------------
>>> Read this topic online here:
>>> http://forum.openscenegraph.org/viewtopic.php?p=68852#68852
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> osg-users mailing list
>>>
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>> _______________________________________________
>> osg-users mailing list
>>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>   ------------------
>> Post generated by Mail2Forum
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=68858#68858
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




More information about the osg-users mailing list