Hi,

I am trying to use an example of a geometry node (from the tutorial) to work 
with my cluster, but I seem to get a weird result. My code is as follows:

        //I want a bigger mesh, but I am  trying with a simple square now
        int N=  2;
        Real32 wMesh[N][N];
        for (int i = 0; i < N; i++)
                for (int j = 0; j < N; j++)
                    wMesh[i][j] = 0;

        GeoPTypesPtr type = GeoPTypesUI8::create();

        beginEditCP(type, GeoPTypesUI8::GeoPropDataFieldMask);

        {

                type->addValue(GL_QUADS);

        }

        endEditCP  (type, GeoPTypesUI8::GeoPropDataFieldMask);



        GeoPLengthsPtr lens = GeoPLengthsUI32::create();

        beginEditCP(lens, GeoPLengthsUI32::GeoPropDataFieldMask);

        {

                lens->addValue((N-1)*(N-1)*4);
        }

        endEditCP  (lens, GeoPLengthsUI32::GeoPropDataFieldMask);


        //create the points for the mesh

        GeoPositions3fPtr pnts = GeoPositions3f::create();

        beginEditCP(pnts, GeoPositions3f::GeoPropDataFieldMask);

        {

                for (int x = 0; x < N; x++)
                    for (int z = 0; z < N; z++){
                        pnts->addValue(Pnt3f(x, wMesh[x][z]), z);
                }
        }

        endEditCP  (pnts, GeoPositions3f::GeoPropDataFieldMask);

        GeoNormals3fPtr norms = GeoNormals3f::create();
        beginEditCP(norms, GeoNormals3f::GeoPropDataFieldMask);
                for (int x = 0; x < N; x++)
                    for (int z = 0; z < N; z++)
                        norms->addValue(Vec3f(0,1,0));
        endEditCP(norms, GeoNormals3f::GeoPropDataFieldMask);

        //create the indices for the mesh
        GeoIndicesUI32Ptr indices = GeoIndicesUI32::create();
        beginEditCP(indices, GeoIndicesUI32::GeoPropDataFieldMask);
                for (int x = 0; x < N-1; x++)
                    for (int z = 0; z < N-1; z++){
                indices->addValue(z*N+x);
                indices->addValue((z+1)*N+x);
                indices->addValue((z+1)*N+x+1);
                indices->addValue(z*N+x+1);
            }
        endEditCP(indices, GeoIndicesUI32::GeoPropDataFieldMask);

        geo=Geometry::create();

        beginEditCP(geo, Geometry::TypesFieldMask     |

                     Geometry::LengthsFieldMask   |

                     Geometry::PositionsFieldMask |

                     Geometry::MaterialFieldMask  );

        {

                geo->setTypes(type);

                geo->setLengths  (lens);

                geo->setIndices(indices);

                geo->setPositions(pnts);

                geo->setNormals(norms);

                geo->setMaterial(getDefaultUnlitMaterial());
        }


        endEditCP  (geo, Geometry::TypesFieldMask     |

                     Geometry::LengthsFieldMask   |

                     Geometry::PositionsFieldMask |

                     Geometry::MaterialFieldMask  );


        NodePtr n = Node::create();

        beginEditCP(n, Node::CoreFieldMask);

        {

                n->setCore(geo);

        }

        endEditCP  (n, Node::CoreFieldMask);


Then I add a client window to my multidisplay window and the geometry looks 
fine in the client window, but the indices seems to not have been sent to 
the server window as I get two bottom intersecting triangles instead of the 
square. I retrieve the list of indices and they are in the correct order. I 
have also tried to manually set the positions in the correct order and this 
seems to work fine (client and server), but not when I use indices.

Is there something I am missing, or am I misunderstanding how indices work??


Thanks,
Karina Rodriguez

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Opensg-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to