opengl-c-graphics
Build, debug, review, and optimize core-profile OpenGL in C.
Skill by Tom-R-Main
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/tom-r-main-opengl-c-graphics
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Python package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/opengl-c-graphics
What's inside
- Skill name
opengl-c-graphics- Description
- Build, debug, review, and optimize core-profile OpenGL in C. Use for contexts, shaders, buffers, textures, GL object lifetimes, and measured GPU performance.
- License
- MIT
- Instructions
- 135 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Files (9)
- SKILL.md
- openai.yaml · agents/
- triangle.c · examples/
- debugging-profiling.md · references/
- glsl-language.md · references/
- modern-pipeline.md · references/
- performance-async.md · references/
- glcheck.sh · scripts/
- test_glcheck.py · tests/
SKILL.md (first lines)
# OpenGL in C Domain skill for writing **modern, core-profile OpenGL in plain C** — not C++. OpenGL is a C API, but most tutorials (including LearnOpenGL) are written in C++ with GLM math and RAII wrapper classes. Your job is to render the same pipeline in idiomatic C: explicit object lifetimes, GL types, checked errors, no hidden destructors. Treat "it linked and drew something" as insufficient — a GL program can render a perfect triangle while leaking objects, ignoring errors, and stalling the GPU every frame. This skill is grounded in three sources, broken out under `references/`: - **LearnOpenGL** → `references/modern-pipeline.md` (setup → draw → advanced GL) - **Orange Book** (GL Shading Language) → `references/glsl-language.md` (GLSL) - **OpenGL Insights** → `references/performance-async.md` + `references/debugging-profiling.md` A complete, C-correct, warning-clean reference program is in `examples/triangle.c`. A verification helper is `scripts/glcheck.sh`. ## First moves (detect the environment before editing) 1. **GL version + profile.** Grep for context hints (`GLFW_CONTEXT_VERSION_*`, `GLFW_OPENGL_CORE_PROFILE`, `glewInit`, raw WGL/GLX attribs). The `#version` in the shaders must match. On macOS, core profile **requires** `GLFW_OPENGL_FORWARD_COMPAT` and caps out at GL 4.1 (no 4.3+ debug output, compute, SSBO). 2. **Loader.** GLAD vs GLEW vs glad2 vs manual `glXGetProcAddress`. Function pointers are invalid until the loader runs *after* a context is current — a `gl*` call before that is a null-pointer crash, not a link error. 3. **Math + window libs.** GLFW/SDL2 for windowing; **cglm** is the C answer to C++'s GLM (column-major `mat4`, feeds `glUniformMatrix4fv` directly). Don't pull in C++ GLM from C. 4. **Build system.** Makefile / CMake / direct `cc`. Note `-std=`, warning flags, and how GL/GLFW are linked (`pkg-config --libs glfw3`, `-framework OpenGL` on macOS, `-lGL -ldl` on Linux). 5. **Reproduce first** for visual bugs: a black screen, wrong colors, or z-fighting each have distinct causes (see Troubleshooting). ## The C mindset for OpenGL - **GL handles are unowned `GLuint`s.** `glGen*`/`glCreate*` give you a name; you own its lifetime and must `glDelete*` it on every exit path. There are no destructors. Name `0` is "none" and is never valid output — use it as your null/failure sentinel. - **Use GL types, never bare `int`.** `GLuint` handles, `GLint` locations/sizes from `glGet*`, `GLsizei` counts, `GLsizeiptr`/`GLintptr` for buffer sizes/offsets (a 32-bit `int` overflows on large buffers), `GLchar` for shader text, `GLuint64` for timer results, `GLfloat` for vertex data. - **Errors are sticky and silent.** A bad call sets an error flag and the call is ignored — rendering simply looks wrong. Compile/link **must** be status-checked; install debug output (below). `glGetUniformLocation` returning `-1` and `glUniform*(-1, ...)` being a silent no-op is the classic "my uniform does nothing" bug. - **Bind-to-edit is global mutable state.** Most calls act on whatever is currently bound. Leaving objects bound across unrelated code is the source of hard-to-trace corruption — bind, edit, unbind, or use DSA (`glNamed*`) on 4.5+. - **`std140` layout must be mirrored byte-for-byte in your C struct** (vec3→16B align, array stride padded to vec4). A mismatch is silently wrong, never an error. See `references/glsl-language.md`. ## Validation gates (run in order; fix failures before moving on) This is the C verification ladder adapted to GL. `scripts/glcheck.sh file.c ...` runs compile gates 1–2 for you; it does not execute the program. Set `GLCHECK_OUTPUT_DIR` to an explicit output directory to retain binaries for runtime checks, otherwise temporary build artifacts are removed. 1. **Strict warnings = correctness failures.** `cc -std=c11 -Wall -Wextra -Wpedantic -Wconversion -Wshadow -Wstrict-prototypes` `-Wmissing-prototypes`. `-Wconversion` catches the `GLint`/`GLsizei`/`size_t` mismatches that pepper GL code. 2. **Sanitized build.** `-fsanitize=address,undefined -fno-omit-frame-pointer`, then run under a real display (GL needs a context; for CI use headless EGL or Xvfb). Catches the use-after-`stbi_image_free`, the off-by-one in an interleaved vertex buffer, the unchecked `glMapBufferRange` returning `NULL`. 3. **GL debug output at runtime** (`references/debugging-profiling.md`). A debug context + `glDebugMessageCallback` with `GL_DEBUG_OUTPUT_SYNCHRONOUS` turns silent GL errors into a breakpoint at the offending call. This is the single highest-leverage debugging step — prefer it over scattering `glGetError`. 4. **No leaked GL objects.** Every `glGen*`/`glCreate*`/`glFenceSync` has a matching `glDelete*`. Audit it like `malloc`/`free`. 5. **Measure, don't guess, performance.** GPU time via timer queries (`glQueryCounter` + `GLuint64`), not CPU wall-clock — the GPU runs frames behind. ## References (open as needed — checklists, not laws) - `references/modern-pipeline.md` — the canonical setup→VAO/VBO→shader→texture→ transform→draw call sequence, plus the advanced-GL topic→API map (framebuffers, UBOs, instancing, MSAA, deferred, PBR). **Start here for "how do I draw X".** - `references/glsl-language.md` — GLSL stages, types, qualifiers, built-in variables/functions (with real signatures), `std140`, and the C↔GLSL boundary gotchas. **Open when writing/binding shaders.** - `references/performance-async.md` — reducing driver calls, buffer orphaning, round-robin multi-buffering, `glMapBufferRange` + fence streaming, PBO texture upload. **Open when the frame is CPU-bound or transfers stall.** - `references/debugging-profiling.md` — debug-output callback, `glGetError`, timer queries, GPU memory tracking. **Open when something is wrong or slow.** ## Common pitfalls - **`gl*` before the loader / before a current context** → segfault. Order: context → make current → load → use. - **Forgetting the EBO is VAO state**: unbinding `GL_ELEMENT_ARRAY_BUFFER` while the VAO is still bound erases it from the VAO. - **Fixed 512-byte info-log buffer** truncates real errors — size from `GL_INFO_LOG_LENGTH` and heap-allocate (see `examples/triangle.c`). - **`glVertexAttribPointer` offset** is a byte count cast to `(void*)`, not a pointer. Integer attributes need `glVertexAttribIPointer`, or they get silently float-converted. - **Matrix transpose/order**: GL is column-major; pass `transpose = GL_FALSE` for GLM/cglm data. Model·View·Projection multiply order matters. - **Texture image flip**: image origin is top-left, GL's is bottom-left — `stbi_set_flip_vertically_on_load`. - **Calling GL inside a debug callback** → undefined behaviour (Insights Ch.33). - **`glBufferSubData`/`glMapBuffer` on an in-flight buffer** → implicit GPU stall; orphan or use `GL_MAP_UNSYNCHRONIZED_BIT` + fences instead. - **macOS** silently lacks GL 4.3+ — no core debug output, compute shaders, or SSBOs. Feature-gate on the actual context version, don't assume. ## Troubleshooting (visual symptoms → likely cause)
From Tom-R-Main/siftable-skills, MIT.
More from Tom-R-Main/siftable-skills
- 0.592score
footwork-tools
Tom-R-Main
Equip an agent with observation and action tools for browser UI, native Mac apps, terminals/services, and saved artifacts.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
pgvector-postgres
Tom-R-Main
Design, review, migrate, measure, or debug PostgreSQL vector retrieval with pgvector.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
paper-design
Tom-R-Main
Create, inspect, edit, import, export, and hand off product or visual designs through Paper and its MCP server.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
grok-guide
Tom-R-Main
Use Grok 4.5 as an explicit strategic control plane above Codex for plan, replan, and completion-audit lifecycles.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
plan
siftable
Produce a visual, grounded plan for an objective.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
filesystem-lifecycle
Tom-R-Main
Audit, classify, reclaim, and prevent regrowth of local filesystem cruft and agent-workspace storage.
SkillAFreshness: A★ 1Claude Code +9 - 0.589score
go
Tom-R-Main
Implement, review, debug, test, migrate, and optimize Go.
SkillAFreshness: A★ 1Claude Code +9 - 0.589score
c-systems-programming
Tom-R-Main
Implement, debug, and review C systems software.
SkillAFreshness: A★ 1Claude Code +9 - 0.589score
css
Tom-R-Main
Implement, debug, and review CSS and Tailwind styling.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
mermaid
siftable
Create Mermaid diagrams and render them through an available host renderer.
SkillAFreshness: A★ 1Claude Code +9 - 0.584score
cloud-environment-runtime
Tom-R-Main
Establish the selected cloud task's execution, network, and credential context before using cloud tools.
SkillAFreshness: A★ 1Claude Code +9 - 0.584score
generating-design-references
Tom-R-Main
Generate and critique a design-reference image when no existing visual precedent fits.
SkillAFreshness: A★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Oct 12, 2026 (16 days ago)
- Last release
- Aug 14, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/Tom-R-Main/siftable-skills
- Website
- siftable.io
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Tom-R-Main
- 0.592score
footwork-tools
Tom-R-Main
Equip an agent with observation and action tools for browser UI, native Mac apps, terminals/services, and saved artifacts.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
pgvector-postgres
Tom-R-Main
Design, review, migrate, measure, or debug PostgreSQL vector retrieval with pgvector.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
grok-guide
Tom-R-Main
Use Grok 4.5 as an explicit strategic control plane above Codex for plan, replan, and completion-audit lifecycles.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
filesystem-lifecycle
Tom-R-Main
Audit, classify, reclaim, and prevent regrowth of local filesystem cruft and agent-workspace storage.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
paper-design
Tom-R-Main
Create, inspect, edit, import, export, and hand off product or visual designs through Paper and its MCP server.
SkillAFreshness: A★ 1Claude Code +9 - 0.589score
css
Tom-R-Main
Implement, debug, and review CSS and Tailwind styling.
SkillAFreshness: A★ 1Claude Code +9
Cite this page
opengl-c-graphics skill. Agent Mart. https://agentmart.dev/skills/tom-r-main-opengl-c-graphics (last updated 2026-10-24)