1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Implement polygon offset in GL3 driver

This commit is contained in:
sfan5 2025-01-04 18:10:29 +01:00
parent 5b14c03301
commit 4774e65ed9
2 changed files with 12 additions and 6 deletions

View file

@ -1313,7 +1313,17 @@ void COpenGL3DriverBase::setBasicRenderStates(const SMaterial &material, const S
getGLBlend(srcAlphaFact), getGLBlend(dstAlphaFact));
}
// TODO: Polygon Offset. Not sure if it was left out deliberately or if it won't work with this driver.
// Polygon Offset
if (resetAllRenderStates ||
lastmaterial.PolygonOffsetDepthBias != material.PolygonOffsetDepthBias ||
lastmaterial.PolygonOffsetSlopeScale != material.PolygonOffsetSlopeScale) {
if (material.PolygonOffsetDepthBias || material.PolygonOffsetSlopeScale) {
GL.Enable(GL.POLYGON_OFFSET_FILL);
GL.PolygonOffset(material.PolygonOffsetSlopeScale, material.PolygonOffsetDepthBias);
} else {
GL.Disable(GL.POLYGON_OFFSET_FILL);
}
}
if (resetAllRenderStates || lastmaterial.Thickness != material.Thickness)
GL.LineWidth(core::clamp(static_cast<GLfloat>(material.Thickness), DimAliasedLine[0], DimAliasedLine[1]));