Changed the default implementation of backdrop text to DEPTH_RANGE and

tweaked the depth range values to minimize the depth rage witout causing z fighting
on osgtext example.
This commit is contained in:
Robert Osfield
2006-08-22 12:33:35 +00:00
parent 98cdf9b3c7
commit 26e3424195

View File

@@ -46,7 +46,7 @@ Text::Text():
_kerningType(KERNING_DEFAULT),
_lineCount(0),
_backdropType(NONE),
_backdropImplementation(POLYGON_OFFSET),
_backdropImplementation(DEPTH_RANGE),
_backdropHorizontalOffset(0.07f),
_backdropVerticalOffset(0.07f),
_backdropColor(0.0f, 0.0f, 0.0f, 1.0f),
@@ -2088,13 +2088,14 @@ void Text::renderWithDepthRange(osg::State& state) const
if (!transformedBackdropCoords.empty())
{
state.setVertexPointer( 3, GL_FLOAT, 0, &(transformedBackdropCoords.front()));
glDepthRange(0.01f + ((max_backdrop_index-backdrop_index)/1000.0f), 1.0);
double offset = double(max_backdrop_index-backdrop_index)*0.003;
glDepthRange( offset, 1.0+offset);
glDrawArrays(GL_QUADS,0,transformedBackdropCoords.size());
}
}
glDepthRange(0.0, 0.982);
glDepthRange(0.0, 1.0);
drawForegroundText(state, glyphquad);
}