From ca97896affc6c168e40b32d7b20aab6fe226d293 Mon Sep 17 00:00:00 2001 From: Param Date: Mon, 29 Jun 2026 20:36:35 +0530 Subject: [PATCH 1/5] Fix tessellation artifacts on hollow polygons --- src/libphigs/wsgl/wsgl_tess.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libphigs/wsgl/wsgl_tess.c b/src/libphigs/wsgl/wsgl_tess.c index a1455a5..a8d8e1e 100644 --- a/src/libphigs/wsgl/wsgl_tess.c +++ b/src/libphigs/wsgl/wsgl_tess.c @@ -26,6 +26,10 @@ static void CALLBACK tessEndCB() { glEnd(); } +static void CALLBACK tessEdgeFlagCB(GLboolean flag) { + glEdgeFlag(flag); +} + static void CALLBACK tessVertexCB(void *data) { Wsgl_tess_vertex *v = (Wsgl_tess_vertex *)data; if (v->has_norm) { @@ -92,6 +96,7 @@ void wsgl_draw_tess_polygon(Wsgl_tess_vertex *vertices, int num_vertices, int re gluTessCallback(tess, GLU_TESS_VERTEX, (void (CALLBACK *)())tessVertexCB); gluTessCallback(tess, GLU_TESS_ERROR, (void (CALLBACK *)())tessErrorCB); gluTessCallback(tess, GLU_TESS_COMBINE, (void (CALLBACK *)())tessCombineCB); + gluTessCallback(tess, GLU_TESS_EDGE_FLAG, (void (CALLBACK *)())tessEdgeFlagCB); gluTessBeginPolygon(tess, NULL); gluTessBeginContour(tess); @@ -115,6 +120,9 @@ void wsgl_draw_tess_polygon(Wsgl_tess_vertex *vertices, int num_vertices, int re gluTessEndPolygon(tess); gluDeleteTess(tess); + /* Restore default edge flag state for subsequent rendering */ + glEdgeFlag(GL_TRUE); + if (record_geom_flag && n_vertices > 0) { wsgl_add_geometry(GEOM_FACE, vertex_indices, normal_indices, n_vertices); } From 02e128ffaafe64d42bde52afd00d35f3c4c3bebd Mon Sep 17 00:00:00 2001 From: Param Date: Mon, 29 Jun 2026 20:42:09 +0530 Subject: [PATCH 2/5] Add GitHub Action to capture screenshots --- .github/workflows/screenshot.yml | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/screenshot.yml diff --git a/.github/workflows/screenshot.yml b/.github/workflows/screenshot.yml new file mode 100644 index 0000000..5a9df8d --- /dev/null +++ b/.github/workflows/screenshot.yml @@ -0,0 +1,36 @@ +name: Screenshot Test + +on: + push: + branches: [ "fix/tessellation-artifacts" ] + +jobs: + test-and-screenshot: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: sudo apt update && sudo apt install --fix-missing cmake gcc gfortran libx11-dev libglu1-mesa-dev libmotif-dev tcsh libxaw7-dev libglew-dev libdlm-dev libgl2ps-dev libpng-dev xvfb imagemagick + + - name: Build + run: | + make config + make build + + - name: Run test_f3 and capture screenshot + run: | + Xvfb :99 -screen 0 1024x768x24 & + export DISPLAY=:99 + sleep 2 + ./build/test_f/test_f3 & + TEST_PID=$! + sleep 5 + import -window root test_f3_output.png + kill $TEST_PID + + - name: Upload Screenshot Artifact + uses: actions/upload-artifact@v4 + with: + name: test_f3-screenshot + path: test_f3_output.png From faa62a7dd6882aeabb70b50b265e6f6206c0805c Mon Sep 17 00:00:00 2001 From: Param Date: Mon, 29 Jun 2026 21:02:01 +0530 Subject: [PATCH 3/5] Fix transparent surfaces occlusion (Issue #34) and add Fortran back property bindings (Issue #35) --- src/libphigs/f_binding/fb_extel.c | 51 +++++++++++++++++++++++++++++++ src/libphigs/wsgl/wsgl_tess.c | 26 ++++++++++++++++ 2 files changed, 77 insertions(+) diff --git a/src/libphigs/f_binding/fb_extel.c b/src/libphigs/f_binding/fb_extel.c index f08ef51..a4b379e 100644 --- a/src/libphigs/f_binding/fb_extel.c +++ b/src/libphigs/f_binding/fb_extel.c @@ -884,3 +884,54 @@ FTN_SUBROUTINE(psmcv3)( spacelist.half_spaces = &list[0]; pset_model_clip_vol3(iop, spacelist); } + +/******************************************************************************* + * psbici + * + * DESCR: set back interior colour index + * RETURNS: N/A + */ +FTN_SUBROUTINE(psbici)( + FTN_INTEGER(coli) + ) +{ + Pint colr_ind = FTN_INTEGER_GET(coli); +#ifdef DEBUG + printf("DEBUG: pset back interior color index set to %d\n", colr_ind); +#endif + pset_back_int_colr_ind(colr_ind); +} + +/******************************************************************************* + * psbis + * + * DESCR: set back interior style + * RETURNS: N/A + */ +FTN_SUBROUTINE(psbis)( + FTN_INTEGER(style) + ) +{ + Pint_style int_style = (Pint_style) FTN_INTEGER_GET(style); +#ifdef DEBUG + printf("DEBUG: pset back interior style set to %d\n", int_style); +#endif + pset_back_int_style(int_style); +} + +/******************************************************************************* + * psbisi + * + * DESCR: set back interior style index + * RETURNS: N/A + */ +FTN_SUBROUTINE(psbisi)( + FTN_INTEGER(stylei) + ) +{ + Pint style_ind = FTN_INTEGER_GET(stylei); +#ifdef DEBUG + printf("DEBUG: pset back interior style index set to %d\n", style_ind); +#endif + pset_back_int_style_ind(style_ind); +} diff --git a/src/libphigs/wsgl/wsgl_tess.c b/src/libphigs/wsgl/wsgl_tess.c index a8d8e1e..60e389f 100644 --- a/src/libphigs/wsgl/wsgl_tess.c +++ b/src/libphigs/wsgl/wsgl_tess.c @@ -98,6 +98,28 @@ void wsgl_draw_tess_polygon(Wsgl_tess_vertex *vertices, int num_vertices, int re gluTessCallback(tess, GLU_TESS_COMBINE, (void (CALLBACK *)())tessCombineCB); gluTessCallback(tess, GLU_TESS_EDGE_FLAG, (void (CALLBACK *)())tessEdgeFlagCB); + /* Determine if depth writing should be disabled for order-independent transparency */ + GLboolean orig_depth_mask; + GLfloat cur_color[4]; + int has_transparency = 0; + + glGetBooleanv(GL_DEPTH_WRITEMASK, &orig_depth_mask); + + if (num_vertices > 0 && vertices[0].apply_cb) { + if (vertices[0].colr_type == PMODEL_RGBA && vertices[0].colr.direct.rgba.alpha < 1.0f) { + has_transparency = 1; + } + } else { + glGetFloatv(GL_CURRENT_COLOR, cur_color); + if (cur_color[3] < 1.0f) { + has_transparency = 1; + } + } + + if (has_transparency && orig_depth_mask == GL_TRUE) { + glDepthMask(GL_FALSE); + } + gluTessBeginPolygon(tess, NULL); gluTessBeginContour(tess); @@ -123,6 +145,10 @@ void wsgl_draw_tess_polygon(Wsgl_tess_vertex *vertices, int num_vertices, int re /* Restore default edge flag state for subsequent rendering */ glEdgeFlag(GL_TRUE); + if (has_transparency && orig_depth_mask == GL_TRUE) { + glDepthMask(GL_TRUE); + } + if (record_geom_flag && n_vertices > 0) { wsgl_add_geometry(GEOM_FACE, vertex_indices, normal_indices, n_vertices); } From 273e897c476d7afb9378998818324a2926cc7197 Mon Sep 17 00:00:00 2001 From: Param Date: Mon, 29 Jun 2026 21:08:04 +0530 Subject: [PATCH 4/5] Fix C90 mixed declarations and code error --- src/libphigs/wsgl/wsgl_tess.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/libphigs/wsgl/wsgl_tess.c b/src/libphigs/wsgl/wsgl_tess.c index 60e389f..2c2fbf5 100644 --- a/src/libphigs/wsgl/wsgl_tess.c +++ b/src/libphigs/wsgl/wsgl_tess.c @@ -87,6 +87,9 @@ void wsgl_draw_tess_polygon(Wsgl_tess_vertex *vertices, int num_vertices, int re int normal_indices[MAX_VERTICES]; int n_vertices = 0; int n_normals = 0; + GLboolean orig_depth_mask; + GLfloat cur_color[4]; + int has_transparency = 0; tess = gluNewTess(); if (!tess) return; @@ -99,10 +102,6 @@ void wsgl_draw_tess_polygon(Wsgl_tess_vertex *vertices, int num_vertices, int re gluTessCallback(tess, GLU_TESS_EDGE_FLAG, (void (CALLBACK *)())tessEdgeFlagCB); /* Determine if depth writing should be disabled for order-independent transparency */ - GLboolean orig_depth_mask; - GLfloat cur_color[4]; - int has_transparency = 0; - glGetBooleanv(GL_DEPTH_WRITEMASK, &orig_depth_mask); if (num_vertices > 0 && vertices[0].apply_cb) { From 1efbd4f54ec68e83b1f7c31108f8461735669d33 Mon Sep 17 00:00:00 2001 From: Param Date: Mon, 29 Jun 2026 21:21:51 +0530 Subject: [PATCH 5/5] Remove duplicate psbis definition --- src/libphigs/f_binding/fb_extel.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/libphigs/f_binding/fb_extel.c b/src/libphigs/f_binding/fb_extel.c index a4b379e..a7a2454 100644 --- a/src/libphigs/f_binding/fb_extel.c +++ b/src/libphigs/f_binding/fb_extel.c @@ -902,23 +902,6 @@ FTN_SUBROUTINE(psbici)( pset_back_int_colr_ind(colr_ind); } -/******************************************************************************* - * psbis - * - * DESCR: set back interior style - * RETURNS: N/A - */ -FTN_SUBROUTINE(psbis)( - FTN_INTEGER(style) - ) -{ - Pint_style int_style = (Pint_style) FTN_INTEGER_GET(style); -#ifdef DEBUG - printf("DEBUG: pset back interior style set to %d\n", int_style); -#endif - pset_back_int_style(int_style); -} - /******************************************************************************* * psbisi * @@ -935,3 +918,4 @@ FTN_SUBROUTINE(psbisi)( #endif pset_back_int_style_ind(style_ind); } +