Skip to content

Basic_viewer: Copy-paste errors in compile_shaders() — wrong error messages and stale comments #9392

@RajdeepKushwaha5

Description

@RajdeepKushwaha5

Issue Details

The compile_shaders() function in Basic_viewer/include/CGAL/Qt/Basic_viewer.h contains 6 copy-paste errors carried over from the clipping plane shader section when the sphere, cylinder, normal, and triangle shader blocks were added.

Bug 1: Wrong error messages (4 occurrences)

The std::cerr fragment shader error messages for 4 different shaders all incorrectly reference "clipping plane" instead of their actual shader name:

Line Program Current message (wrong) Correct message
989 rendering_program_sphere "Adding fragment shader for clipping plane FAILED" "Adding fragment shader for sphere FAILED"
1022 rendering_program_cylinder "Adding fragment shader for clipping plane FAILED" "Adding fragment shader for cylinder FAILED"
1054 rendering_program_normal "Adding fragment shader for clipping plane FAILED" "Adding fragment shader for normal FAILED"
1086 rendering_program_triangle "Adding fragment shader for clipping plane FAILED" "Adding fragment shader for triangle FAILED"

Each line calls addShader() on the correct program (e.g., rendering_program_sphere.addShader(fragment_shader_sphere)), but the error message still says "clipping plane".

Bug 2: Stale comment in cylinder section

Line 997 has the comment // clipping plane shader at the start of the Cylinder shader block. It should be // cylinder shader. The real clipping plane section starts at line 917.

Bug 3: Wrong section comment for triangle shader

Line 1059 has // Normal shader as the section header for what is actually the Triangle shader block. The real Normal shader section is at line 1027.

Impact

When sphere/cylinder/normal/triangle fragment shaders fail to attach, the error output blames the clipping plane shader, making it very hard to identify the actual failing shader during debugging. The stale comments also mislead developers reading the code.

Source Code

No custom source code needed — the bug is in the CGAL source itself.

File: Basic_viewer/include/CGAL/Qt/Basic_viewer.h, function compile_shaders().

To verify, search for "clipping plane FAILED" in the file — there are 9 matches total: 5 are in the actual clipping plane section (lines 922–935, correct), and 4 are in the sphere/cylinder/normal/triangle sections (lines 989, 1022, 1054, 1086, incorrect).

Environment

  • Operating system (Windows/Mac/Linux, 32/64 bits): All platforms (code-level bug, not platform-specific)
  • Compiler: Any
  • Release or debug mode: Both
  • Specific flags used (if any): None
  • CGAL version: main branch (commit as of 2026-03-21)
  • Boost version: N/A
  • Other libraries versions if used (Eigen, TBB, etc.): N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions