On Wed, 30 Jun 2004, Vincent VIVANLOC wrote:

Hi!

> > > if your code compiles, then _textures is a multi field of
> > > NodePtr, not a multi field of textures.
> > 
> > True.
> > I did some typeid-ing so we know what we're talking about:
> > typeid(i)=N9__gnu_cxx17__normal_iteratorIPN3osg7NodePtrESt6vectorIS2_SaIS2_EEEE
> > typeid(*i)=N3osg7NodePtrE
> > typeid(**i)=N3osg12TextureChunkE
> > 
> >  
> > > for(MFNodePtr::iterator i=_textures.begin();i!=_textures.end();i++)
> > >     ^^^^^^^^^
> > > 
> > > So it's not surprising that you get problems when you cast *i
> > > to a TextureChunkPtr.
> > 
> > Well, it is (to me, anyway). :)
> > I actually want a TextureChunkPtr, which is typedef'd from Ptr. Which 
> > makes it the same type as NodePtr (which is also typedef'd from Ptr).
> 
> Ouch... no, they seems to be, but they are not.

What *are* they? I grep'd for "typedef Ptr", "class Ptr" and "#define 
Ptr", but couldn't get anything. I found some typedefs for Core::Ptr, but 
that's it...

> > As we've seen above, the NodePtr *i points to a TextureChunk **i. That 
> > seems to make it a TextureChunkPtr. If it doesn't, what do I have to do, 
> > to cast it?
> > 
> 
> If you want absolutely to use iterators - I presume TextureChunkPtr 
> might expose some higher level access method, isn't it ? 
> like the good olde [] operator and size() 

Well, the iterator is for MFNodePtr, which is a std::vector<something>, 
IIRC. The problem is to get a TextureChunkPtr. I do get a TextureChunk, 
but have no idea how to make that into a TextureChunkPtr.

> Just cast an iterator from TextureChunkPtr following 
> the example in paragraph concerning "Efficient Manipulation of Geometry"
> http://www.oliver-abert.de/opensg/Geometry.html#GeometryEfficientManipulation

That's what I initially did. While that compiled, it caused a segfault.

Thanks anyway.

Tobias

> > > -----Original Message-----
> > > From: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED] Behalf Of Tobias
> > > Berghoff
> > > Sent: Montag, 28. Juni 2004 20:49
> > > To: [email protected]
> > > Subject: [Opensg-users] Segfault at endEditCP
> > > 
> > > 
> > > Hallo!
> > > 
> > > Probably a serious braino, but anyway:
> > > I've changed part of the VRML loader and get a segmentation fault when 
> > > calling endEditCP.
> > > The Code looks like this:
> > > 
> > > _textures contains one texture at this point, btw.
> > > 
> > > 
> > > std::cerr<<"setting textures\n";
> > > beginEditCP(pChunkMat, ChunkMaterial::ChunksFieldMask);
> > > {
> > >   for(MFNodePtr::iterator i=_textures.begin();i!=_textures.end();i++)
> > >     {
> > >         std::cerr<<"trying...\n";
> > >         TextureChunkPtr pTexture = TextureChunkPtr::dcast(*i);
> > >         pChunkMat->addChunk(pTexture);
> > >         std::cerr<<"added texture\n";
> > >     }
> > > }
> > > std::cerr<<"before endEditCP "<<pChunkMat<<"\n";
> > > endEditCP(pChunkMat, ChunkMaterial::ChunksFieldMask);
> > > std::cerr<<"textures done\n";
> > > 
> > > Which generates this output:
> > > 
> > > setting textures FCPtr 0x0xbfffe840:ChunkMaterialPtr(0x0x8163eb0)
> > > trying...
> > > added texture
> > > before endEditCP FCPtr 0x0xbfffe840:ChunkMaterialPtr(0x0x8163eb0)
> > > Speicherzugriffsfehler (aka segfault)
> > > 
> > > Any quick idea, or do I have to work myself through the code of 
> > > endEditCP? 
> > > :)
> > > 
> > > Tobias
> > > 



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to