Re: [osg-users] Newbie question about concave polygons
Rick, Can you post an image of what you are seeing? I ran your code (without the setBoundaryOnly line) and it seems to render correctly. Screenshot is attached. Glenn On Wed, Apr 23, 2008 at 3:34 PM, R Schwantes [EMAIL PROTECTED] wrote: Hi list, I've been a long time lurker. Finally have some free time to get my hands dirty with OSG. I'm new to computer graphics, and so far its definitely been an adventure. I'm stuck trying to draw a concave polygon, it looks like I need to use tessellation to break the geometry down into smaller convex parts? I wrote some code using osgUtil::Tessellator but it doesn't work quite right. If I set boundryOnly = true, it looks how I would want it. If boundryOnly is set to false the polygon is not shaped correctly, and in this example is splintered into two parts. I've attached my code, can someone point me in the right direction? Thanks, Rick . /* Polygon should look similar to * * ___ * || * | |_ * | | * | | * | | * || */ osg::Geometry* geom = new osg::Geometry; osg::Vec3Array* vertices = new osg::Vec3Array; vertices-push_back(osg::Vec3(0,68,0)); vertices-push_back(osg::Vec3(0,57,0)); vertices-push_back(osg::Vec3(86,57,0)); vertices-push_back(osg::Vec3(86,0,0)); vertices-push_back(osg::Vec3(98,0,0)); vertices-push_back(osg::Vec3(98,57,0)); vertices-push_back(osg::Vec3(92,57,0)); vertices-push_back(osg::Vec3(92,68,0)); geom-setVertexArray(vertices); geom-addPrimitiveSet(new osg::DrawArrays(GL_POLYGON,0,vertices-getNumElements())); osgUtil::Tessellator* tessellator = new osgUtil::Tessellator(); tessellator-setTessellationType(osgUtil::Tessellator::TESS_TYPE_GEOMETRY); tessellator-setBoundaryOnly(True); tessellator-setWindingType( osgUtil::Tessellator::TESS_WINDING_ODD); tessellator-retessellatePolygons(*geom); buildingGeode-addDrawable(geom); ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Glenn Waldron : Pelican Mapping : http://pelicanmapping.com : 703-652-4791 attachment: 2008-04-24_082649.jpg___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Newbie question about concave polygons
Thanks for the input. I first tried using GL_TRIANGLES, incorrect output was 2 triangles. Then I read Glenn's response and tried my code on a different computer, and it worked fine. So now I'm left wondering what is wrong with my computer? I deleted osg and rebuilt ver 2.2.0, updated the driver for my Nvidia GeForce 8600GTS, still no success. Are their any known issues simialr to this? I've attached screen shots of setBoundaryOnly=false, and using GL_Triangles with no tessellation . Other specs on my computer: Intel core 2 quad, 4gb ram, Windows XP 32bit, 2x19 NEC LCDs Thanks, Rick attachment: BoundaryOnly_False.gifattachment: Triangles.gif___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Newbie question about concave polygons
Hi Rick, On Thu, Apr 24, 2008 at 4:31 PM, R Schwantes [EMAIL PROTECTED] wrote: So now I'm left wondering what is wrong with my computer? I deleted osg and rebuilt ver 2.2.0, updated the driver for my Nvidia GeForce 8600GTS, still no success. Are their any known issues simialr to this? The tessellation is done by glu, and is effectively just a software utility library that sits ontop of OpenGL. Have a look it which version of the glu you have on the different machines as it would seem that this is what is buggy in your instance. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Newbie question about concave polygons
from a quick look, it appears your geometry is just two adjacent quads (ie 4 triangles), no? No need to invoke a tesselator for a concave polygon. Just use 3 verts for each of the 4 triangles (12 verts total) and draw as GL_TRIANGLES. cheers -- mew On Wed, Apr 23, 2008 at 2:34 PM, R Schwantes [EMAIL PROTECTED] wrote: Hi list, I've been a long time lurker. Finally have some free time to get my hands dirty with OSG. I'm new to computer graphics, and so far its definitely been an adventure. I'm stuck trying to draw a concave polygon, it looks like I need to use tessellation to break the geometry down into smaller convex parts? I wrote some code using osgUtil::Tessellator but it doesn't work quite right. If I set boundryOnly = true, it looks how I would want it. If boundryOnly is set to false the polygon is not shaped correctly, and in this example is splintered into two parts. I've attached my code, can someone point me in the right direction? Thanks, Rick . /* Polygon should look similar to * * ___ * || * | |_ * | | * | | * | | * || */ osg::Geometry* geom = new osg::Geometry; osg::Vec3Array* vertices = new osg::Vec3Array; vertices-push_back(osg::Vec3(0,68,0)); vertices-push_back(osg::Vec3(0,57,0)); vertices-push_back(osg::Vec3(86,57,0)); vertices-push_back(osg::Vec3(86,0,0)); vertices-push_back(osg::Vec3(98,0,0)); vertices-push_back(osg::Vec3(98,57,0)); vertices-push_back(osg::Vec3(92,57,0)); vertices-push_back(osg::Vec3(92,68,0)); geom-setVertexArray(vertices); geom-addPrimitiveSet(new osg::DrawArrays(GL_POLYGON,0,vertices-getNumElements())); osgUtil::Tessellator* tessellator = new osgUtil::Tessellator(); tessellator-setTessellationType(osgUtil::Tessellator::TESS_TYPE_GEOMETRY); tessellator-setBoundaryOnly(True); tessellator-setWindingType( osgUtil::Tessellator::TESS_WINDING_ODD); tessellator-retessellatePolygons(*geom); buildingGeode-addDrawable(geom); ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Mike Weiblen -- Austin Texas USA -- http://mew.cx/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Newbie question about concave polygons
Hi list, I've been a long time lurker. Finally have some free time to get my hands dirty with OSG. I'm new to computer graphics, and so far its definitely been an adventure. I'm stuck trying to draw a concave polygon, it looks like I need to use tessellation to break the geometry down into smaller convex parts? I wrote some code using osgUtil::Tessellator but it doesn't work quite right. If I set boundryOnly = true, it looks how I would want it. If boundryOnly is set to false the polygon is not shaped correctly, and in this example is splintered into two parts. I've attached my code, can someone point me in the right direction? Thanks, Rick . /* Polygon should look similar to * * ___ * || * | |_ * | | * | | * | | * || */ osg::Geometry* geom = new osg::Geometry; osg::Vec3Array* vertices = new osg::Vec3Array; vertices-push_back(osg::Vec3(0,68,0)); vertices-push_back(osg::Vec3(0,57,0)); vertices-push_back(osg::Vec3(86,57,0)); vertices-push_back(osg::Vec3(86,0,0)); vertices-push_back(osg::Vec3(98,0,0)); vertices-push_back(osg::Vec3(98,57,0)); vertices-push_back(osg::Vec3(92,57,0)); vertices-push_back(osg::Vec3(92,68,0)); geom-setVertexArray(vertices); geom-addPrimitiveSet(new osg::DrawArrays(GL_POLYGON,0,vertices-getNumElements())); osgUtil::Tessellator* tessellator = new osgUtil::Tessellator(); tessellator-setTessellationType(osgUtil::Tessellator::TESS_TYPE_GEOMETRY); tessellator-setBoundaryOnly(True); tessellator-setWindingType( osgUtil::Tessellator::TESS_WINDING_ODD); tessellator-retessellatePolygons(*geom); buildingGeode-addDrawable(geom); ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org