Hi Dirk, Scrive Dirk Reiners <[EMAIL PROTECTED]>:
> > Hi Toni, > > Antonio Bleile wrote: > > Hi, > > > > I can't find documentation about how normals are > > indexed/referenced in OpenSG. I'd like to know > > how I can specify per vertex normals and > > per face normals! > > > > I use something like this to create a mesh: > > > > osg::beginEditCP(n_geom_core); > > n_geom_core->setTypes (type); // GL_TRIANGLES > > n_geom_core->setLengths (lens); > > n_geom_core->setIndices (indices); > > n_geom_core->setPositions(pnts); > > n_geom_core->setMaterial(cmat); > > n_geom_core->setNormals(norms); // per vertex? > > osg::endEditCP(n_geom_core); > > OpenSG doesn't really have face normals, or any face-based attributes for > that > matter. Which is partially because of the unclear definition of what a face > is > in connected primitives like strips and fans, and partially because OpenGL > doesn't have them, which means to support them you have to either do copy > magic > or fall back to immediate mode and drop performance. So by default all > attributes, including normals, are vertex-based. > > To do face normals you have to use multi-indexed geometry (which is immediate > mode and slow anyway), and have the same normal index for all three vertices. > calcFaceNormals does that for you, is you really need them. > > A simpler workaround is to use flat shading on the pieces that you want flat. > That won't work well with shaders, but for normal OpenGL stuff it should work > just fine. Hi, said this, I wonder how you import an IndexedFaceSet vrml node when normalPerVertex is FALSE, do you clone the vertices associated to each face? See: http://www.cs.vu.nl/~eliens/documents/vrml/reference/CH3.HTM#IndexedFaceSet Regards, Toni ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Opensg-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensg-users
