Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > Inventor API > Re: DrawStyle::...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 482 of 504
Post > Topic >>

Re: DrawStyle::LINES ignored

by Anatoli <anatoli.barski@[EMAIL PROTECTED] > Jun 14, 2007 at 04:20 AM

I found the bug:

SoDrawStyle should be added BEFORE (didn't know the order is
im****tant) the object is added to the scene:

>         result->addChild(vertices);
>         result->addChild(fs);
>         result->addChild(sphere);
>         result->addChild(drawStyle); <-- this line should be the first
>         result->addChild(material);

On 14 Jun., 11:55, Anatoli <anatoli.bar...@[EMAIL PROTECTED]
> wrote:
> I want to create a grid on the floor using the following function. For
> test reasons I also create an SoSphere object inside this function.
>
> My idea for the grid is a square with the drawstyle set to LINES. The
> square is generated as SoFaceSet.
>
> My problem is: I can see both sphere and square, but FILLED and the
> material color is also ignored.
>
> SoSeparator* tOIRobotViewerXML::createGrid()
> {
>         SoSeparator *result = new SoSeparator;
>         SoCoordinate3 *vertices = new SoCoordinate3();
>
>         SbVec3f points[8];
>         points[0] = SbVec3f(-4000, 0, -4000);
>         points[1] = SbVec3f(4000, 0, -4000);
>         points[2] = SbVec3f(4000, 0, 4000);
>         points[3] = SbVec3f(-4000, 0, 4000);
>
>         points[4] = SbVec3f(-4000, 0, -4000);
>         points[5] = SbVec3f(-8000, 0, -4000);
>         points[6] = SbVec3f(-8000, 0, -8000);
>         points[7] = SbVec3f(-4000, 0, -8000);
>         vertices->point.setValues(0, 8, points);
>
>         SoFaceSet *fs = new SoFaceSet();
>         int32_t values[] = {4,4};
>         fs->numVertices.setValues(0, 2, values);
>
>         SoSphere* sphere = new SoSphere();
>         sphere->radius = 1000;
>
>         SoDrawStyle *drawStyle = new SoDrawStyle();
>         drawStyle->style = SoDrawStyle::LINES;
>         drawStyle->lineWidth = 1;
>         drawStyle->linePattern = 0xaa;
>
>         SoMaterial *material = new SoMaterial();
>         material->ambientColor.setValue(.33,.22,.27);
>         material->diffuseColor.setValue(.88,.57,.11);
>         material->specularColor.setValue(.99,.94,.81);
>         material->****niness =.28;
>
>         result->addChild(vertices);
>         result->addChild(fs);
>         result->addChild(sphere);
>         result->addChild(drawStyle);
>         result->addChild(material);
>
>         return result;
>
> }
 




 2 Posts in Topic:
DrawStyle::LINES ignored
Anatoli <anatoli.barsk  2007-06-14 02:55:00 
Re: DrawStyle::LINES ignored
Anatoli <anatoli.barsk  2007-06-14 04:20:10 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 1:18:55 CST 2008.