classic-gfx

Diagnoses and explains the OpenGL/WebGL2 rendering layer of the classic-wgl Rust engine.

1|1|Updated Aug 18, 2021
One-click install
npx skills add https://github.com/guilledk/classic-wgl --skill classic-gfx-guilledk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: classic-gfx
Source: https://github.com/guilledk/classic-wgl/tree/main/.agents/skills/classic-gfx
Command: npx skills add https://github.com/guilledk/classic-wgl --skill classic-gfx-guilledk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Debugging rendering issues in the classic-wgl engine's classic-gfx crate is hard because GL state is scoped per draw call, depth testing is selectively enabled, and failures like black screens or missing textures produce no GL errors. This Skill provides the full contract for the Gfx struct, draw_* functions, shaders, and framebuffer management so you can pinpoint rendering bugs quickly. ## Core Features & Use Cases - GL State Contract Reference: Documents exactly what begin_frame sets (BLEND, LEQUAL depth func) and what it does not (DEPTH_TEST), plus per-draw depth/stencil state for tilemap, iso sprites, and line drawing. - Draw Function Signatures: Full parameter documentation for draw_tilemap, draw_iso_sprite (Normal/Ghost passes), draw_sprite, draw_rect, draw_sdf, and draw_line_loop/strip, including shader-to-draw mapping. - Shadow & Lighting Systems: Covers the directional shadow map (bias mechanisms, light space vs screen space) and the std140 UBO dynamic point/spot light pipeline. - Use Case: When the UI phase renders a black screen, use this Skill to identify that DEPTH_TEST was left enabled by a prior draw call, then verify the restore sequence in the relevant draw function. ## Quick Start Ask the AI to explain why draw_tilemap renders but the SDF text overlay is invisible, using the classic-gfx skill's DEPTH_TEST contract.

Frequently Asked Questions about classic-gfx

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my WebGL2 UI render a black screen after drawing a tilemap?

A black screen in the UI phase usually means DEPTH_TEST was left enabled by a previous draw call. Only draw_tilemap and draw_iso_sprite enable depth testing, and each must disable it afterward; verify the restore sequence in the relevant draw function.

How do I draw an isometric sprite with depth testing in WebGL2?

Use draw_iso_sprite with IsoSpritePass::Normal, which enables DEPTH_TEST with LEQUAL and writes depth only when a depth map is bound. The engine runs all normal passes first, then all ghost passes with GREATER depth func and stencil group tests.

Does classic-gfx support GLSL 100 shaders?

No, all shaders are written in GLSL 300 es using in/out/texture syntax, which is incompatible with GLSL 100 attribute/varying/texture2D syntax. Sources are embedded at compile time and resolved through ShaderSourceRegistry.

Why does my draw call appear in the golden trace but render nothing?

The orthographic projection clips z outside [-10000, 10000] silently with no GL error. This typically happens when a render-list sort key like -20000 is mistakenly used as the model z instead of a value within the near/far range.

What are the limitations of the SDF text rendering?

draw_sdf is single-pass only, so shadow or glow effects require separate draw-list entries with distinct SdfTextRender components. The softEdge uniform is hardcoded to 0.08, and no mipmaps are generated for the atlas.

Why do point lights not cast shadows in the renderer?

The directional shadow map shadows only the sun diffuse term; UBO point lights are unoccluded by design. Shadow bias uses polygon offset for terrain casters, normal-offset for receivers, and slope-scaled offset for sprite billboards.