Skip to content

Cube node shape renders black canvas via C API (CommandScreen doesn't implement DrawCube/FinishRender3D) #47

Description

@willwade

Problem

When LP_GEOMETRY is set to Cube (Options::CUBE), the canvas goes completely black — no nodes are visible. The app doesn't crash; it just renders only the background clear-screen and nothing else.

Root cause

CDasherViewSquare in Cube mode calls Screen()->DrawCube(...) for each node and Screen()->FinishRender3D(...) to composite the 3D layers. These are virtual methods on CDasherScreen (DasherScreen.h:98-103).

The C API's CommandScreen (in CAPI.cpp) — the screen adapter that translates DasherCore rendering into the flat int[] command buffer consumed by all frontends — never overrides these methods. They fall through to the empty base implementation, so zero draw commands are emitted for cube nodes.

Only the clear-screen command (opcode 0) fires — hence the black canvas.

The flat rectangle rendering (default node shape) works fine because it uses DasherRectangle() / DasherPolyline(), which CommandScreen does translate into the int[] buffer.

Suggested fix

Option A (preferred): Implement DrawCube + FinishRender3D in CommandScreen — translate cube quads into the flat int[] command format. The cubes are shaded rectangles with depth-based colour; they don't need actual 3D. This could emit opcode 4 (filled rectangle) for each cube face with the depth-shaded colour.

Option B: Have CDasherViewSquare detect that the screen doesn't support 3D (e.g., a Supports3D() capability check) and fall back to flat rectangle rendering. Simpler but loses the cube visual.

Context

  • Reported via TestFlight (Dasher-Apple build 75+, iOS 27).
  • Same class of problem as the Circle geometry crashes (fix(view): circle shape SIGABRT + CircleTo stack overflow #46) — a rendering mode the C-API path was never tested with.
  • All frontends using dasher.h are affected (Apple, Windows, GTK, Android, Web).

Activity

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