diff --git a/include/osg/State b/include/osg/State index cbf655cfd..7cefaf155 100644 --- a/include/osg/State +++ b/include/osg/State @@ -477,6 +477,10 @@ class OSG_EXPORT State : public Referenced, public Observer _currentPBO = 0; } + typedef std::vector Indices; + Indices _quadIndices[6]; + + void drawQuads(GLint first, GLsizei count, GLsizei primCount=1); inline void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei primcount) { diff --git a/src/osg/State.cpp b/src/osg/State.cpp index 8c2d22047..c23a413d6 100644 --- a/src/osg/State.cpp +++ b/src/osg/State.cpp @@ -1343,3 +1343,47 @@ void State::updateModelViewAndProjectionMatrixUniforms() _normalMatrixUniform->set(normalMatrix); } } + +void State::drawQuads(GLint first, GLsizei count, GLsizei primCount) +{ + // osg::notify(osg::NOTICE)<<"State::drawQuads("<65536) + { + osg::notify(osg::NOTICE)<<"Warning: State::drawQuads("<= indices.size()) + { + // we need to expand the _indexArray to be big enough to cope with all the quads required. + unsigned int numExistingQuads = indices.size()/6; + unsigned int numRequiredQuads = endOfIndices/6; + indices.reserve(endOfIndices); + for(unsigned int i=numExistingQuads; i