Skip to content

Viewer: detect software OpenGL and choose the drawing path; smooth fixed-size labels on hardware renderers #566

Open

Description

@ohlincha

ECCE does not know which OpenGL renderer it is running on. Two recent changes to label drawing work around problems that appear to occur with software rendering, but apply to every renderer:

  • Use fixed-pixel text for 3D viewer labels #538 changed the 3D viewer labels to the 9×15 fixed-pixel bitmap font, so labels keep their size when zooming. On hardware renderers this font is blocky (no antialiasing).
  • Fix GTK activation and Builder MO rendering #565 draws the viewer's corner text as screen-space quads instead of glBitmap display lists, because glBitmap was reported to crash under a software renderer while MOs were shown. Measurement and lattice labels (AtomMeasureDist.C, AtomMeasureAngle.C, SGLattice.C) still use glBitmap display lists.

Proposal:

  1. Read GL_RENDERER once, when the first viewer context is made. Classify the renderer as software if it matches llvmpipe, softpipe, swrast, SVGA3D (VMware), virgl, "Microsoft Basic Render Driver", "GDI Generic" or "Apple Software Renderer".
  2. Software renderer:
    • draw all viewer text as geometry: the corner text as in Fix GTK activation and Builder MO rendering #565, and the measurement and lattice labels the same way;
    • start in the quick transparency mode, instead of waiting for frames slower than ECCE_TRANSPARENCY_FALLBACK_MS.
  3. Hardware renderer: draw labels with an antialiased font at a fixed pixel size. This keeps the fixed size from Use fixed-pixel text for 3D viewer labels #538 without the bitmap font.
  4. Overrides:
    • ECCE_GL_PATH=software|hardware;
    • a preference under Edit > Preferences > Advanced.
  5. Report the renderer and the chosen path:
    • in Help > About;
    • in Help > Report a Problem;
    • on stderr at start.

Open question: whether the crash under software rendering is caused by glBitmap at all. A reproduction with a large conjugated molecule's MOs, on hardware and software renderers, should come first.

Activity

  1. ohlincha commented on Oct 26, 2026

    @ohlincha
    CollaboratorAuthor

    Font, once the renderer detection is in: settle the label font so that it suits both uses — readable and fixed-size labels on software renderers and VMs (the reason for #538), and smooth antialiased text on hardware renderers (the 9×15 bitmap font looks blocky there). Compare candidates side by side as screenshots on both renderers before choosing.

  2. ohlincha commented on Oct 26, 2026

    @ohlincha
    CollaboratorAuthor

    Andy 10-26: in 9.4.1 if reasonably small; size to be assessed first.

  3. ohlincha commented on Oct 26, 2026

    @ohlincha
    CollaboratorAuthor

    Sized 10-26: steps 1, 2, 4, 5 (detect GL_RENDERER, software path for all viewer text + quick transparency, ECCE_GL_PATH + preference, report in About/Report a Problem/stderr) are small enough for 9.4.1. Step 3 and the font choice (antialiased fixed-size labels on hardware, side-by-side screenshots) come after 9.4.1.

  4. ohlincha commented on Oct 26, 2026

    @ohlincha
    CollaboratorAuthor

    Steps 1, 2, 4, 5 merged (74580fe, in 9.4.1): GL_RENDERER read at the first viewer frame; on software renderers all viewer text is drawn as geometry and transparency starts in the quick mode; ECCE_GL_PATH=software|hardware and Edit > Preferences > Advanced > OpenGL drawing override it; the renderer and chosen path are on stderr, in Help > About and in Report a Problem. Hardware renderers draw as before. Step 3 and the font choice remain.

  5. ohlincha commented on Oct 26, 2026

    @ohlincha
    CollaboratorAuthor

    Step 3, decided (Andy 10-26): a label font setting in Edit > Preferences: System (default), DejaVu Sans, Noto Sans, Liberation Sans, Fixed 9×15 (bitmap); size in pixels, so labels keep their size when zooming (#538). Hardware renderers: the chosen font, antialiased (each label rasterised once through wx and drawn as one screen-space textured quad). Software renderers keep the 9×15 geometry text whatever the setting (no textures there, the path #565 worked around); a note by the setting says so; ECCE_GL_PATH / the OpenGL drawing preference still override. DejaVu Sans bundled in the Windows and macOS packages. Tests: label pixels on both paths, software path ignores the font setting; real-click checks on Windows and macOS. Planned first for 9.4.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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