Re: [osg-users] how to get the handle of opengl texture that corresponds to a OSG::Texture

2015-09-09 Thread Qingjie Zhang
Hi Robert,

Do you mean the DrawCallback in the Camera class, which contains
virtual void operator () (osg::RenderInfo& renderInfo) ? And here I can use the 
RenderInfo right?

As I know, the following code can get a contextID:
camera->getGraphicsContext()->getState()->getContextID();
Is this contextID same as the upper one?

And, 

Thank you!

Qingjie.


robertosfield wrote:
> Hi Qingjie,
> 
> 
> The RenderInfo is managed by the my the rendering back end, it's passed to 
> all draw callbacks and Drawables.
> 
> 
> Robert
> 
> 
> On 9 September 2015 at 04:29, Qingjie Zhang < ()> wrote:
> 
> > Hi Robert,
> > I'm knowing that the RenderInfo->getContextID() can give me the contextID 
> > to use in the getTextureObject(uint contextID), but where can I get the 
> > RenderInfo? I searched the source code of Texture but did not find that..
> > Many thanks.
> > 
> > Qingjie
> > 
> > 
> > robertosfield wrote:
> > 
> > > Hi Qingjie,
> > > 
> > > 
> > > The osgTexture::TextureObject* osg::Texture::getTextureObject(uint 
> > > contextID)  method can be used to get the OSG's wrapper for the OpenGL 
> > > texture object.  The TextureObject::id() method returns the OpenGL 
> > > texture object id.
> > > 
> > > 
> > > Robert.
> > > 
> > > 
> > > On 8 September 2015 at 15:20, Qingjie Zhang < ()> wrote:
> > > 
> > > 
> > > > Hi,
> > > > I generated a texture2d with osg, to use the texture in CUDA, I have to 
> > > > get the corresponding "opengl texture" handle(GLuint), and then access 
> > > > to the texture by the handle in CUDA.
> > > > Now I don't know how to get the handle.
> > > > Many thanks for your reply!!!
> > > > ...
> > > > 
> > > > Thank you!
> > > > 
> > > > Cheers,
> > > > Qingjie
> > > > 
> > > > --
> > > > Read this topic online here:
> > > > http://forum.openscenegraph.org/viewtopic.php?p=65061#65061 
> > > > (http://forum.openscenegraph.org/viewtopic.php?p=65061#65061) 
> > > > (http://forum.openscenegraph.org/viewtopic.php?p=65061#65061 
> > > > (http://forum.openscenegraph.org/viewtopic.php?p=65061#65061))
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > ___
> > > > osg-users mailing list
> > > >   ()
> > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > > >  
> > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)
> > > >  
> > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > > >  
> > > > (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=65073#65073 
> > (http://forum.openscenegraph.org/viewtopic.php?p=65073#65073)
> > 
> > 
> > 
> > 
> > 
> > ___
> > osg-users mailing list
> >  ()
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org 
> > (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=65075#65075





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] how to get the handle of opengl texture that corresponds to a OSG::Texture

2015-09-09 Thread Robert Osfield
Hi Qingjie,

On 9 September 2015 at 09:27, Qingjie Zhang <305479...@qq.com> wrote:

> Do you mean the DrawCallback in the Camera class, which contains
> virtual void operator () (osg::RenderInfo& renderInfo) ? And here I can
> use the RenderInfo right?
>

Yes.  You can attach draw callbacks to Drawables, StateAtttribute and
Camera's.



>
> As I know, the following code can get a contextID:
> camera->getGraphicsContext()->getState()->getContextID();
> Is this contextID same as the upper one?
>

If you only need the contexID then getting it from the graphics context is
perfectly fine.  What route to take depends on when you need to do your
queries.

I would add that the TextureObject for each context is only created by the
draw thread for each context, so the TextureObject won't exist right away
when you create your osg::Texture and assign them to the scene graph.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] how to get the handle of opengl texture that corresponds to a OSG::Texture

2015-09-09 Thread Robert Osfield
Hi Qingjie,

The RenderInfo is managed by the my the rendering back end, it's passed to
all draw callbacks and Drawables.

Robert

On 9 September 2015 at 04:29, Qingjie Zhang <305479...@qq.com> wrote:

> Hi Robert,
> I'm knowing that the RenderInfo->getContextID() can give me the contextID
> to use in the getTextureObject(uint contextID), but where can I get the
> RenderInfo? I searched the source code of Texture but did not find that..
> Many thanks.
>
> Qingjie
>
>
> robertosfield wrote:
> > Hi Qingjie,
> >
> >
> > The osgTexture::TextureObject* osg::Texture::getTextureObject(uint
> contextID)  method can be used to get the OSG's wrapper for the OpenGL
> texture object.  The TextureObject::id() method returns the OpenGL texture
> object id.
> >
> >
> > Robert.
> >
> >
> > On 8 September 2015 at 15:20, Qingjie Zhang < ()> wrote:
> >
> > > Hi,
> > > I generated a texture2d with osg, to use the texture in CUDA, I have
> to get the corresponding "opengl texture" handle(GLuint), and then access
> to the texture by the handle in CUDA.
> > > Now I don't know how to get the handle.
> > > Many thanks for your reply!!!
> > > ...
> > >
> > > Thank you!
> > >
> > > Cheers,
> > > Qingjie
> > >
> > > --
> > > Read this topic online here:
> > > http://forum.openscenegraph.org/viewtopic.php?p=65061#65061 (
> http://forum.openscenegraph.org/viewtopic.php?p=65061#65061)
> > >
> > >
> > >
> > >
> > >
> > > ___
> > > osg-users mailing list
> > >  ()
> > >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> (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=65073#65073
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Change picked points' color ---why can't work in the pick function?

2015-09-09 Thread Trajce Nikolov NICK
Hi,

can you try geom->dirtyDisplayLists() after changing the color?

Nick

On Wed, Sep 2, 2015 at 12:27 PM, Yexin W  wrote:

> Hi,
>
> Guys, I have a pick problem. What I want to do is loading 10 points with
> their loactions and colors. I want to use poly pick, and use another color
> to show the picked points.
> The loading points process is as follows:
>
>
> Code:
>
> osg::ref_ptr geom = new osg::Geometry();
> osg::ref_ptr v = new osg::Vec3Array;
> osg::ref_ptr clr = new osg::Vec4Array;
> v->push_back(osg::Vec3(0.0, 0.0, 0.0));
> ... // 10 points in total
> clr->push_back(osg::Vec4(1.0, 0.0, 1.0, 1.0f));
> ...// set the color
> geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POINTS, 0,
> v->size()));
> // after set the color and normal, add the geometry to Geode node
> geode->addDrawable(geom.get());
>
>
>
>
>
> Then I want to use ploy pick, the problem is : when I put the following
> codes in the pick() function in Pickhandler class, I found out that the
> color of the picked premitiveset has been changed, however, nothing changed
> in the view window. The following codes are in pick function:
>
>
> Code:
>
> if (picker->containsIntersections())
> {
> osgUtil::PolytopeIntersector::Intersections intersections =
> picker->getIntersections();
> osgUtil::PolytopeIntersector::Intersections::iterator iter;
> for (iter = intersections.begin(); iter != intersections.end(); iter++)
> {
> osg::NodePath nodepath = (*iter).nodePath;
> node = (nodepath.size() >= 1) ? nodepath[nodepath.size() - 1] : 0;
> int pointIndex = (*iter).primitiveIndex;
> osg::Geode * geode = dynamic_cast (node);
> osg::Geometry * geom = dynamic_cast(geode->getDrawable(0));
> osg::Vec4Array * clrary =
> dynamic_cast(geom->getColorArray());
> clrary->operator [] (pointIndex) = osg::Vec4(0.0, 1.0, 0.0, 1.0f);
> geom->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
> node->addUpdateCallback(new CessnaCallback()); // not helpful
> viewer->updateTraversal(); //not helpful
> //viewer->run();//not helpful
> }
> }
>
>
>
>
>
> First, I thought may be the colors have not been changed, so I tested
> changing several points' color in the main function, like this:
>
>
> Code:
>
> osg::Geode * geode1 = dynamic_cast (nodePt.get());
> osg::Geometry * geom =
> dynamic_cast(geode1->getDrawable(0));
> osg::Vec4Array * clrary =
> dynamic_cast(geom->getColorArray());
> clrary->operator [] (10) = osg::Vec4(0.0, 1.0, 0.0, 1.0f);
> clrary->operator [] (6) = osg::Vec4(0.0, 1.0, 0.0, 1.0f);
> clrary->operator [] (2) = osg::Vec4(0.0, 1.0, 0.0, 1.0f);
> geom->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
>
>
>
>
> It changed the colors! So it confuses me why it can't work in the pick
> function? Any body any idears?
> Any ideas and suggestions would be appreciated!
>
>
> Thank you!
>
> Cheers,
> Yexin
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=64994#64994
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Oculus+OSG

2015-09-09 Thread Björn Blissing
Hi,

I just fixed a performance related bug. 

Due to misuse of an enum I had accidentally disabled all culling. (This bug 
would probably been avoided if strongly typed enum a'la C++11 were used).

This bug only affects users using Oculus SDK 0.6 and 0.7. I urge all users of 
these versions of OsgOculusViewer to update to the head revision on GitHub.

Best regards,
Björn

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=65077#65077





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] ffmpeg library version expected for OSG 3.2.3

2015-09-09 Thread Robert Osfield
Hi Sam,

On 9 September 2015 at 00:24, sam  wrote:

> What version of ffmpeg is required to use the plugin for OSG 3.2.3? When
> trying to use the latest build of ffmpeg; I get some undeclared identifier
> errors which seem to be caused by deprecation of some functions within
> ffmpeg.
>

I don't have an official version number for which version the plugin will
work with - we try to get it compiling with what contributors have access
to/using at the time of release, but sometimes with projects like ffmpeg
the API can change so rapidly, or is distributed in different forms that it
ends up breaking quite soon.  Thankfully there are very few API's out there
as rapidly changing as ffmpeg.

Which version of ffmpeg are you trying to use?

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] ffmpeg library version expected for OSG 3.2.3

2015-09-09 Thread sam
Hi Robert,

I'm attempting to use the latest git build of ffmpeg (
http://ffmpeg.zeranoe.com/builds/). I am going to try with 2.5.2 next.
Would it be possible to get ffmpeg added to the dependencies package for
OSG? I'll let you know how it goes.

Thanks, Sam

On Wed, Sep 9, 2015 at 7:45 AM, Robert Osfield 
wrote:

> Hi Sam,
>
> On 9 September 2015 at 00:24, sam  wrote:
>
>> What version of ffmpeg is required to use the plugin for OSG 3.2.3? When
>> trying to use the latest build of ffmpeg; I get some undeclared identifier
>> errors which seem to be caused by deprecation of some functions within
>> ffmpeg.
>>
>
> I don't have an official version number for which version the plugin will
> work with - we try to get it compiling with what contributors have access
> to/using at the time of release, but sometimes with projects like ffmpeg
> the API can change so rapidly, or is distributed in different forms that it
> ends up breaking quite soon.  Thankfully there are very few API's out there
> as rapidly changing as ffmpeg.
>
> Which version of ffmpeg are you trying to use?
>
> Robert.
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] how to get the handle of opengl texture that corresponds to a OSG::Texture

2015-09-09 Thread Qingjie Zhang
Hi Robert,
To get the handle of opengl texture, I attached a DrawCallback to the main 
camera, doing like these codes:
struct MyCameraPostDrawCallback : public osg::Camera::DrawCallback
{
virtual void operator()(const osg::RenderInfo )
{
int contextID = renderInfo.getContextID();
GLuint frontTexHandle = 
m_frontTex->getTextureObject(contextID)->id();
GLuint backTexHandle = 
m_backTex->getTextureObject(contextID)->id();
}
};
camera->setPostDrawCallback(new MyCameraPostDrawCallback);

But the function operator() int the callback does not run, I tried 
setPostDrawCallback() and setFinalDrawCallback(), they were the same.
I was thinking that the DrawCallback would run every frame...
Can you tell me when the callback runs?
And, to get the handle,  is it right to attach DrawCallback to camera? If not, 
can you tell me the detailed method to get the handle?

Thank you,

Qingjie.


robertosfield wrote:
> Hi Qingjie,
> On 9 September 2015 at 09:27, Qingjie Zhang < ()> wrote:
> 
> > Do you mean the DrawCallback in the Camera class, which contains
> > virtual void operator () (osg::RenderInfo& renderInfo) ? And here I can use 
> > the RenderInfo right?
> > 
> 
> 
> Yes.  You can attach draw callbacks to Drawables, StateAtttribute and 
> Camera's.
> 
> 
>  
> 
> >  
> > As I know, the following code can get a contextID:
> > camera->getGraphicsContext()->getState()->getContextID();
> > Is this contextID same as the upper one?
> > 
> 
> 
> If you only need the contexID then getting it from the graphics context is 
> perfectly fine.  What route to take depends on when you need to do your 
> queries.
> 
> 
> I would add that the TextureObject for each context is only created by the 
> draw thread for each context, so the TextureObject won't exist right away 
> when you create your osg::Texture and assign them to the scene graph.
> 
> 
> 
> Robert.
> 
>  
> 
>  --
> Post generated by Mail2Forum


--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=65083#65083





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] pfObject::getNamedUserDataSlot

2015-09-09 Thread Tony Vasile
Is there an equivalent function to the Performer 
pfObject::getNamedUserDataSlot? Our code uses it a lot to store object data. 
I'm guessing we could just store the data in a map and uses the slot id 
returned as a key.


Tony V

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=65084#65084





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] ffmpeg library version expected for OSG 3.2.3

2015-09-09 Thread sam
Using ffmpeg 2.5.2 cleans up the compilation issues. I used a precompiled
version of ffmpeg which was compiled with a prior version of VS so I do get
a SAFESH warning.

On Wed, Sep 9, 2015 at 9:26 AM, sam  wrote:

> Hi Robert,
>
> I'm attempting to use the latest git build of ffmpeg (
> http://ffmpeg.zeranoe.com/builds/). I am going to try with 2.5.2 next.
> Would it be possible to get ffmpeg added to the dependencies package for
> OSG? I'll let you know how it goes.
>
> Thanks, Sam
>
> On Wed, Sep 9, 2015 at 7:45 AM, Robert Osfield 
> wrote:
>
>> Hi Sam,
>>
>> On 9 September 2015 at 00:24, sam  wrote:
>>
>>> What version of ffmpeg is required to use the plugin for OSG 3.2.3? When
>>> trying to use the latest build of ffmpeg; I get some undeclared identifier
>>> errors which seem to be caused by deprecation of some functions within
>>> ffmpeg.
>>>
>>
>> I don't have an official version number for which version the plugin will
>> work with - we try to get it compiling with what contributors have access
>> to/using at the time of release, but sometimes with projects like ffmpeg
>> the API can change so rapidly, or is distributed in different forms that it
>> ends up breaking quite soon.  Thankfully there are very few API's out there
>> as rapidly changing as ffmpeg.
>>
>> Which version of ffmpeg are you trying to use?
>>
>> Robert.
>>
>>
>> ___
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] [Questio nabout StateSet.cpp] truncated attribute override value?

2015-09-09 Thread Julien Valentin
Hi,
Iwould like to introspect StateSet in order to know which override value is 
activated for a particular stateset.
I parse AttributeList for this 

Code:
for( osg::StateSet::AttributeList::const_iterator 
it=ss->getAttributeList().begin();it!=ss->getAttributeList().end() ; it++)
{
if((*it).second.first ==stateattribute)
{ 
if( (*it).second.second & osg::StateAttribute::ON)
return(1);  
else return(0);
}



but according to StateSet.cpp l.1662

Code:
attributeList[attribute->getTypeMemberPair()] = 
RefAttributePair(attribute,value&(StateAttribute::OVERRIDE|StateAttribute::PROTECTED));



the ON OFF bit is removed from the given user value. So I can't determine if an 
osg::Attribute is ON or OFF but only if it's OVERRIDE or PROTECTED
I would like to know if there's a known reason behind this logic & and further 
if you know a mean to retrieve the ON/OFF bit.

Thank you!

Cheers,
Julien

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=65081#65081





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org