diff --git a/GL/draw.c b/GL/draw.c index f9c5de9..85dd8e5 100644 --- a/GL/draw.c +++ b/GL/draw.c @@ -591,6 +591,24 @@ static inline void _readPositionData(const GLuint first, const GLuint count, Ver } else { assert(0 && "Not Implemented"); } + + if(glIsEnabled(GL_POLYGON_OFFSET_FILL)){ + GLfloat offset_units=0.0f, offset_factor=0.0f; + glGetFloatv(GL_POLYGON_OFFSET_FACTOR, &offset_factor); + glGetFloatv(GL_POLYGON_OFFSET_UNITS, &offset_units); + + /* + o = m * factor + r * units + where m is the maximum depth slope of the polygon and r is the smallest value guaranteed to produce a resolvable difference in window coordinate depth values. + The value r is an implementation-specific constant. + */ + + float offset = 0.01f * offset_factor + 0.001f * offset_units; + int i; + for( i=0;i