Dear all,
I have compiled inventor on Suse 10 64-bit Linux, and there seems to be an odd
red bias in what I am seeing. I have modified the example
05.2.IndexedFaceSet.c++ , as enclosed below... and I am seeing a red stellated
dodecahedron, even with no color specified at all. If I try to specify a blue,
I get a magenta, and so on.
I compiled with -fPIC. Can anyone suggest a course of action.
#if 0
// Colors for the 12 faces
static float colors[12][3] =
{
{1.0, .0, 0}, { .0, .0, 1.0}, {0, .7, .7}, { .0, 1.0, 0},
{ .7, .7, 0}, { .7, .0, .7}, {0, .0, 1.0}, { .7, .0, .7},
{ .7, .7, 0}, { .0, 1.0, .0}, {0, .7, .7}, {1.0, .0, 0}
};
#else
// Colors for the 12 faces
static float colors[12][3] =
{
{ 0.0, 0.0, 0.0},{ 0.0, 0.0, 0.0},{ 0.0, 0.0, 0.0},{ 0.0, 0.0, 0.0},
{ 0.0, 0.0, 0.0},{ 0.0, 0.0, 0.0},{ 0.0, 0.0, 0.0},{ 0.0, 0.0, 0.0},
{ 0.0, 0.0, 0.0},{ 0.0, 0.0, 0.0},{ 0.0, 0.0, 0.0},{ 0.0, 0.0, 0.0}
};
#endif
// Routine to create a scene graph representing a dodecahedron
SoSeparator *
makeStellatedDodecahedron()
{
SoSeparator *result = new SoSeparator;
result->ref();
SbVec3f pos1= SbVec3f(0,0,3);
SbVec3f pos2= SbVec3f(0,0,-3);
SbVec3f colorWhite= SbVec3f(1,1,1);
SoPointLight * light1 = new SoPointLight;
SoPointLight * light2 = new SoPointLight;
light1->location.setValue(pos1);
light1->color.setValue(colorWhite);
light2->location.setValue(pos2);
light2->color.setValue(colorWhite);
result->addChild(light1);
result->addChild(light2);
// Define colors for the faces
SoMaterial *myMaterials = new SoMaterial;
myMaterials->diffuseColor.setValues(0, 12, colors);
result->addChild(myMaterials);
SoMaterialBinding *myMaterialBinding = new SoMaterialBinding;
myMaterialBinding->value = SoMaterialBinding::PER_FACE;
result->addChild(myMaterialBinding);
// Define coordinates for vertices
SoCoordinate3 *myCoords = new SoCoordinate3;
myCoords->point.setValues(0, 12, vertexPositions);
result->addChild(myCoords);
// Define the IndexedFaceSet, with indices into
// the vertices:
SoIndexedFaceSet *myFaceSet = new SoIndexedFaceSet;
myFaceSet->coordIndex.setValues(0, 72, indices);
result->addChild(myFaceSet);
result->unrefNoDelete();
return result;
}
I am a novice with inventor.
Thanks for your kind assistance.
Best regards,
Michel Audette, Ph.D.
Innovation Center Computer Assisted Surgery (ICCAS)
Semmelweisstraße 14
Leipzig, Germany
Phone: ++49 (0) 341 / 97 - 1 20 13
Fax: ++49 (0) 341 / 97 - 1 20 09
|