From 2598b02243206eb5a99bcb5049df7a480f0e6115 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 1 Jul 2004 14:27:22 +0000 Subject: [PATCH] Changed the generation of primtive set to use DrawElementsUShort for even index sets that can be represented by UBytes, thisis to try to keep to fast paths more likely to be supported by graphics drivers. --- src/osgUtil/TriStripVisitor.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/osgUtil/TriStripVisitor.cpp b/src/osgUtil/TriStripVisitor.cpp index 55bf7ff7c..0bb9fe1b9 100644 --- a/src/osgUtil/TriStripVisitor.cpp +++ b/src/osgUtil/TriStripVisitor.cpp @@ -472,18 +472,12 @@ void TriStripVisitor::stripify(Geometry& geom) std::copy(indices.begin(),indices.end(),std::back_inserter(*elements)); new_primitives.push_back(elements); } - else if (maxValue>=256) + else { osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(GL_QUADS); std::copy(indices.begin(),indices.end(),std::back_inserter(*elements)); new_primitives.push_back(elements); } - else - { - osg::DrawElementsUByte* elements = new osg::DrawElementsUByte(GL_QUADS); - std::copy(indices.begin(),indices.end(),std::back_inserter(*elements)); - new_primitives.push_back(elements); - } } } } @@ -519,16 +513,9 @@ void TriStripVisitor::stripify(Geometry& geom) std::copy(pitr->m_Indices.begin(),pitr->m_Indices.end(),std::back_inserter(*elements)); new_primitives.push_back(elements); } - else if (maxValue>=256) - { - osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(pitr->m_Type); - elements->reserve(pitr->m_Indices.size()); - std::copy(pitr->m_Indices.begin(),pitr->m_Indices.end(),std::back_inserter(*elements)); - new_primitives.push_back(elements); - } else { - osg::DrawElementsUByte* elements = new osg::DrawElementsUByte(pitr->m_Type); + osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(pitr->m_Type); elements->reserve(pitr->m_Indices.size()); std::copy(pitr->m_Indices.begin(),pitr->m_Indices.end(),std::back_inserter(*elements)); new_primitives.push_back(elements);