Steven,
The tesselator prefers the polygons to be tesselated to have the 'same'
normals or at least reasonably parallel - a cube is precisely the opposite
of course, the normals point everywhere.
The examples in osgTesselate.cpp show that the OSG tesselator handles the
sample tesselations in the red book the same way as OpenGL does (while this
should not be surprising, the earliest versions of tesselator could only
handle simple closed curves).
The routine "makeHouse" shows how to build a house from 4 walls with holes
in; a little effort should result in being able to merge the resultant
geometries into a single geometry. Each wall is a single polygon with holes
cut in, but a look at the red book geometries should show you some
alternative tesselations that you could use in place of any of the wall
tesselations. http://www.opengl.org/resources/code/samples/redbook/ (near
bottom of the page, screen dump named "tesswind") shows how a number of
contours are converted into polygons. The OpenGL (and OSG) tesselator
converts a set of closed loops into a collection of polygons using a winding
rule to define which enclosed areas are converted into polygons and which
areas represent voids. Non-flat loops can be handled by either:
ensuring the loops are nearly parallel OR
call setTesselationNormal(const osg::Vec3 norm) to give a vector to
identify the loops winding numbers uniquely.
Thus you should consider using one face at a time and tesselate, then merge
the geometries.
A similar effect to tesselation/CSG is demonstrated in osgdelanay.cpp -
delaunay triangulation with constraints. Consider a face of your cube with a
hole drilled into it; the face would be a delaunay terrain (with just 4
points of course) and the constraints would be the hole(s) in the face. The
DelaunayTriangulator will provide a triangulation of the terrain plus hole
vertices, with delaunay edges forced to follow the constraints. Calling
removeInternalTriangles will delete the triangles internal to the
constraints, result: face with holes in.
Geoff
----- Original Message -----
From: "Steven T. Hatton" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, October 26, 2006 1:09 AM
Subject: [osg-users] Tessellating a closed surface
I create a cube as a single instance of osg::Geometry. I want to use
tessellation to put a drill hole in the cube. A bit of experimentation
has
suggested that I should not try to tessellate a closed surface. OSG
appears
to treat the entire geometry as a single surface.
When I tried to tessellate the cube, it vanished. When I removed a few
faces
from the cube I ended up with triangles lying in planes which are not
parallel to any surface of the original cube.
Is tessellation only applicable to a plane surface? Is it always applied
to
the osg::Geometry instance as a whole? In order to use tessellation to
drill
holes in solids with planer faces, should I create a geometry for each
face I
want a hole in?
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
--
This email has been verified as Virus free
Virus Protection and more available at http://www.plus.net
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/