From fa58d0164463dbec8a4fe69fbaf2c0d95b56a747 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 25 Oct 2017 16:29:25 +0100 Subject: [PATCH] Added optimization for text where the colour alpha value is 0.0, returning early to aovid any GL calls. --- src/osgText/Text.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/osgText/Text.cpp b/src/osgText/Text.cpp index cfc7cf969..94ac0e923 100644 --- a/src/osgText/Text.cpp +++ b/src/osgText/Text.cpp @@ -1115,6 +1115,8 @@ void Text::drawImplementation(osg::RenderInfo& renderInfo) const void Text::drawImplementationSinglePass(osg::State& state, const osg::Vec4& colorMultiplier) const { + if (colorMultiplier.a()==0.0f || _color.a()==0.0f) return; + osg::VertexArrayState* vas = state.getCurrentVertexArrayState(); bool usingVertexBufferObjects = state.useVertexBufferObject(_supportsVertexBufferObjects && _useVertexBufferObjects); bool usingVertexArrayObjects = usingVertexBufferObjects && state.useVertexArrayObject(_useVertexArrayObject);