/3dcodeverse:3d-lang-opengl-pythonfrom 3dcodeverse
Guides writing moderngl programs with exact setup/render signatures, sampled-time trap, FBO final pass, AST lint rules, and build constraints for a headless EGL graphics pipeline.
Ships in 3dcodeverse. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You write ONE module, src/program.py, with a lifetime: setup(ctx, width, height) runs
ONCE and returns your state; render(ctx, state, t, frame, fbo) may be called for any t,
any number of times, in any order, and draws the frame for that t into the framebuffer it is
handed. No window, no context creation, no clock of your own.
src/program.py REQUIRED defines setup() and render()
src/*.glsl optional shader sources, one file per shader so program.py keeps only the GL plumbing; read with Path(__file__).with_name("x.glsl").read_text()
Only these two globs are delivered; another src/*.py is a lint WARN (stray_file).
references/interface.md is the interface, executable.
def setup(ctx: moderngl.Context, width: int, height: int): # called ONCE; returns your state
def render(ctx: moderngl.Context, state, t: float, frame: int, fbo: moderngl.Framebuffer) -> None:
... # multi-pass into your own FBOs allowed
fbo.use() # the build's framebuffer (RGBA f4 + depth) — draw the FINAL image into it LAST
fbo,
clears it to (0, 0, 0, 1) with depth 1.0, sets ctx.viewport to the full size and calls
render. frame is the index into that merged schedule — not a 60 fps counter.t; if a state must integrate, integrate to t inside
the call. Same t → same image, whatever was rendered before.render the build reads fbo back as float and flips the rows: draw with y up, do not
flip in the shader. If you draw into your own FBOs, call fbo.use() and reset
ctx.viewport = (0, 0, width, height) before the final pass. Never call ctx.screen.moderngl, numpy, math, random, struct, array, pathlib,
typing, dataclasses, itertools, functools, collections, colorsys, enum,
__future__; anything else is an ERROR.os, sys, io, time, datetime, signal,
tempfile, subprocess and network modules; open / exec / eval / compile /
__import__ / input / exit / quit / breakpoint; file-system writes (.write_text /
.write_bytes / .unlink / .mkdir / .rmdir / .rename); moderngl.create_context() /
create_standalone_context(); time.time() / perf_counter() / monotonic();
gl_FragColor, attribute / varying in a shader string.#version other than 330 core (glsl_version); random.* without
random.seed(...) or a default_rng(...) (unseeded_random) — seed in setup; a file over
120 000 characters; an extra src/*.py.cleanup() callback: when you replace resources, release each VAO, buffer, texture,
framebuffer and program you own; never release the supplied ctx or fbo.#version 330 core on its first line (nothing before it),
uses in / out and declares out vec4 fragColor;.ctx.vertex_array(prog, [(buffer, "3f 3f 2f", "in_pos", "in_normal", "in_uv")], index_buffer=ibo):
names match the vertex shader's ins; x pads bytes ("3f 3f 2x4"); /i is per-instance
("3f 1f/i", vao.render(instances=n)). A wrong float count silently shuffles the data.
buffer.write(...) keeps the byte size.in or uniform the compiler optimised away is absent from prog: setting it raises
KeyError: 'u_name' — remove it, pad it, or guard with if "u_name" in prog:.prog["u"].value = 1.0 / (r, g, b); matrices: numpy is row-major and GLSL column-major, so
prog["u_m"].write(M.T.astype("f4").tobytes()), never .value = m.tolist().prog["u_tex"].value = k once, tex.use(location=k) on every
render before the draw that samples it.ctx.clear(...) clears whatever framebuffer is bound (my_fbo.clear(...) for your own). An
offscreen framebuffer tests depth only with a depth_attachment= (ctx.depth_renderbuffer);
reading and writing the same texture in one pass is undefined.CULL_FACE a front face is counter-clockwise from outside (ctx.front_face defaults to
"ccw"; wound the other way the mesh is inside out). GL 3.3 core: no
line_width above 1, no GL_QUADS; ctx.wireframe = True is a debugging aid.src/program.py:LINE: <Exception>; GLSL compile errors show the driver
log with line numbers inside the shader STRING.3dcode gl-frames; the cap is the highest score the round can get)| measured | threshold | finding | cap |
|---|---|---|---|
| any NaN / Inf pixel | ≥ 1 | nan ERROR | 0 |
| every frame black | > 97 % of pixels under luminance 0.03 in each frame | black ERROR | 0.5 |
| every frame blown | > 97 % over 0.98 in each frame | blown ERROR | 0.5 |
| largest mean |Δ| between consecutive frames | < 0.002 (motion planned) | static WARN | 0.5 |
| largest mean |Δ| between consecutive frames | > 0.35 | flicker WARN | 0.7 |
| mean edge density | < 0.002 | low_detail WARN ("a near-flat gradient") | none |
| a lint ERROR | any | 0.6 | |
| the build fails (import, setup, render, timeout) | 0 | ||
An unmet must acceptance item caps at 0.7. A periodic wrap that jumps between two sampled | |||
| times is the flicker finding. Get the frame into a readable band before spending on hue and | |||
| palette, which are invisible on dark, low-chroma pixels. The judge's named defects are the | |||
3d-lang-glsl-shader skill's (flat_fill, comb_artefact, opaque_shapes_for_light, | |||
no_dark_range, white_wash, candy_saturation, stretched_aspect, placeholder_look). |
write → 3dcode gl-probe (imports? one frame at t = 1 s) → fix each error at the file:line
it names → 3dcode gl-probe again until it runs → 3dcode check (renders the judged frames,
runs the gl_frames gate) → fix each ERROR (NaN, black, blown) → 3dcode judge. Do not finish
while gl-probe reports anything. A pass that looks wrong is edited in its own shader file or
its draw code with the host's edit tool; never rewrite a file. Deleting a pass is a legitimate
fix. The round's hand-over, the one look at renders per refine round and the stop rules are the 3dcodeverse skill's ## The loop.
What SKILL.md sets; muted values are Claude Code's defaults
29 skills in this plugin
/3dcodeverseUse for ANY request to make, measure, judge or improve a 3D thing in code: a model, object or prop, a mechanism or robot with joints, a scene or environment, a shader or OpenGL effect — in Blender bpy, CadQuery, Three.js, URDF, GLSL or moderngl. This is 3D coding with the 3dcodeverse plugin: raw executable 3D code that the 3dcode instruments build, measure, render, gate and score. First step, all in ONE read: this file, skills/3d-lang-<language, hyphenated>/SKILL.md and skills/3dcodeverse/references/plan-<static|articulated|scene|graphics>.md (urdf_blender: also skills/3d-lang-blender/SKILL.md and plan-static.md, which it builds on); no c3d-* skill until a 3dcode finding or score item names its topic./3d-lang-blenderUse when writing, refining or repairing a static_object in Blender bpy (language blender): the files and builder names the lint expects, the Z-up metre frame, naming, the sandbox (allowed imports, forbidden bpy calls), the exact thresholds check-contract / check-connectivity / detail_budget measure, what the GLB exporter keeps, the Blender 5.2.2 API traps, and the 3dcode loop that ships it./3d-lang-cadqueryUse when writing, refining or repairing a static_object in CadQuery (language cadquery): the module-level `result` assembly the wrapper reads, named parts and instances, the Z-up metre frame, the lint's import and call lists, the thresholds check-contract / check-connectivity / detail_budget measure, the OCC kernel facts that fail a build, and the 3dcode loop./3d-lang-glsl-shaderUse when writing, refining or repairing a graphics-track fragment shader (language glsl_shader): the files (one include file per layer, pasted above shader.frag), the uniform block the build prepends (never redeclare it), the two entry points, the gl-frames gate thresholds (NaN, black/blown, static, flicker, low detail) with their score caps, the lint's GLSL 330 rules, the feedback buffer, the judge's named defects, and the 3dcode loop./3d-lang-scene-blenderUse when writing, refining or repairing a scene in Blender bpy (language scene_blender): the module files and their exact functions (env height_at/build_env, zone build, asset build_<snake>), the ctx every builder receives, the Z-up frame and the Y-up plan conversion, allowed imports and the lint's forbidden table, Blender 5.2 API facts, what Cycles does with what you build, motion as keyframes/drivers, the placement and frame gate thresholds, and the 3dcode loop./3d-lang-scene-threejsUse when writing, refining or repairing a scene in three.js (language scene_threejs): the module files and their exact exports (createScene, env heightAt/buildEnv/SUN_AZIMUTH_DEG, zone build, asset build<Name>), the Y-up metre frame, imports and the forbidden list, the harness-owned src/lib toolbox, the thresholds check-placement, scene-views (exposure, camera, motion) and scene-probe measure, naming, and the 3dcode loop.npx claudepluginhub gaoypeng/3dcodeverse --plugin 3dcodeverseOther plugins' skills for the same job