From 5957c2108202cbc7f8d446593f07d787a6b87881 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 4 Jul 2002 09:49:12 +0000 Subject: [PATCH] Fixed the TriangleFunctor QUAD_STRIP code so that it produces consistent results. --- include/osg/Drawable | 8 +++--- src/Demos/osggeometry/osggeometry.cpp | 37 +++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/include/osg/Drawable b/include/osg/Drawable index 4b1a0ce9d..36544d260 100644 --- a/include/osg/Drawable +++ b/include/osg/Drawable @@ -435,7 +435,7 @@ public: for(GLsizei i=3;i tf; + drawable.applyPrimitiveOperation(tf); + + std::cout<addPrimitive(new osg::DrawArrays(osg::Primitive::POLYGON,0,numCoords)); - + + printTriangles("Polygon",*polyGeom); // add the points geomtry to the geode. geode->addDrawable(polyGeom); @@ -347,6 +371,8 @@ osg::Node* createScene() polyGeom->addPrimitive(new osg::DrawArrays(osg::Primitive::QUADS,0,numCoords)); + printTriangles("Quads",*polyGeom); + // add the points geomtry to the geode. geode->addDrawable(polyGeom); } @@ -394,6 +420,8 @@ osg::Node* createScene() polyGeom->addPrimitive(new osg::DrawArrays(osg::Primitive::QUAD_STRIP,0,numCoords)); + printTriangles("Quads strip",*polyGeom); + // add the points geomtry to the geode. geode->addDrawable(polyGeom); } @@ -462,6 +490,8 @@ osg::Node* createScene() polyGeom->addPrimitive(new osg::DrawArrays(osg::Primitive::TRIANGLE_FAN,12,5)); + printTriangles("Triangles/Strip/Fan",*polyGeom); + // add the points geomtry to the geode. geode->addDrawable(polyGeom); } @@ -568,7 +598,7 @@ osg::Node* createBackground() // contains unsigned char indicies, UShortDrawElements which contains unsigned short indices, // and UIntDrawElements whcih contains ... unsigned int indices. // The first parameter to DrawElements is - polyGeom->addPrimitive(new osg::UShortDrawElements(osg::Primitive::QUADS,4,myIndices)); + polyGeom->addPrimitive(new osg::UShortDrawElements(osg::Primitive::QUADS,numIndices,myIndices)); // new we need to add the texture to the Drawable, we do so by creating a // StateSet to contain the Texture StateAttribute. @@ -600,6 +630,9 @@ osg::Node* createBackground() return transform; } + + + int main( int argc, char **argv ) {