Hi

that is hopefully only a cut&paste bug, you load to nodeptr
>> 'cone' and but retrieve the geometry core from 'node'. BTW
Yeah it was cut & paste bug.

Also I would use dynamic_cast<Geometry *>(node->getCore());
Yeah I also used previously and enable RTTI before posting.But it deosnot make any difference.

I am also attaching off file for referance. When i am loading file using OFF loader it is reading indice true. But when i am trying read from Geometery indices it's sequance it is totally changed.




----- Original Message ----- From: "Gerrit Voß" <[email protected]>
To: <[email protected]>
Sent: Friday, June 12, 2009 4:49 PM
Subject: Re: [Opensg-users] How to acccess indices in Geometry



Hi,

On Fri, 2009-06-12 at 16:34 +0530, alex wrote:
Hi Gerrit

Here is the code. I think there is some sort of coding mistake

NodeRefPtr cone = SceneFileHandler::the()->read(image);

Geometry* geo = (Geometry*)node->getCore();

that is hopefully only a cut&paste bug, you load to nodeptr
'cone' and but retrieve the geometry core from 'node'. BTW

Also I would use dynamic_cast<Geometry *>(node->getCore());

The hard C-Style cast will convert everything to a geometry pointer,
not just geometries. But as you loops below don't explode it seems
the cast does not go to wrong.

The other thing to try is to use:

NodeRefPtr cone = SceneFileHandler::the()->read(image, NULL);

in order to disable any default graphOp.



if (geo == NULL) return 0;

GeoVectorPropertyRecPtr pos = geo->getPositions();

GeoIntegralPropertyUnrecPtr posIndex =
geo->getIndex(Geometry::PositionsIndex);

if (pos == NULL || posIndex == NULL) return 0;

for (UInt32 i=0; i<pos->getSize(); ++i)

{

OSG::Pnt3f p;

pos->getValue(p, i);

// use this vertex here or push some where

}



for (UInt32 i=0; i<posIndex->getSize(); i+=3)

{


int value=0;

posIndex->getValue(value,i);

faces.push_back(value);

posIndex->getValue(value,i+1);

faces.push_back(value);

posIndex->getValue(value,i+2);

faces.push_back(value);


}

This psuecode for refereance. Please tell me if i am doing anything wrong

No, except for the above it looks ok. Could you send me the off file
too ?

kind regards,
 gerrit



------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Attachment: image0.off
Description: Binary data

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to