DRW_STATE_CULL_FRONT = (1 << 9),
DRW_STATE_WIRE = (1 << 10),
DRW_STATE_POINT = (1 << 11),
- /* DRW_STATE_STIPPLE_2 = (1 << 12), */ /* Not used */
- /* DRW_STATE_STIPPLE_3 = (1 << 13), */ /* Not used */
+ DRW_STATE_OFFSET_POSITIVE = (1 << 12), /* Polygon offset. Does not work with lines and points. */
+ DRW_STATE_OFFSET_NEGATIVE = (1 << 13), /* Polygon offset. Does not work with lines and points. */
/* DRW_STATE_STIPPLE_4 = (1 << 14), */ /* Not used */
DRW_STATE_BLEND = (1 << 15),
DRW_STATE_ADDITIVE = (1 << 16),
}
}
+ /* Polygon Offset */
+ {
+ int test;
+ if (CHANGED_ANY_STORE_VAR(
+ DRW_STATE_OFFSET_POSITIVE |
+ DRW_STATE_OFFSET_NEGATIVE,
+ test)) {
+ if (test) {
+ glEnable(GL_POLYGON_OFFSET_FILL);
+ /* Stencil Write */
+ if ((state & DRW_STATE_OFFSET_POSITIVE) != 0) {
+ glPolygonOffset(1.0f, 1.0f);
+ }
+ else if ((state & DRW_STATE_OFFSET_NEGATIVE) != 0) {
+ glPolygonOffset(-1.0f, -1.0f);
+ }
+ else {
+ BLI_assert(0);
+ }
+ }
+ else {
+ glDisable(GL_POLYGON_OFFSET_FILL);
+ }
+ }
+ }
+
#undef CHANGED_TO
#undef CHANGED_ANY
#undef CHANGED_ANY_STORE_VAR