forge-mesh-loading — gamedev forge-mesh-loading, forge-gpu, community, gamedev, ide skills, graphics-programming, sdl-gpu, Claude Code, Cursor, Windsurf

v1.0.0
GitHub

About this Skill

Perfect for Graphics Agents needing advanced 3D model rendering capabilities with SDL's GPU API and Wavefront OBJ files. Learn real-time graphics programming and build games with SDL's GPU API. Tutorials, code examples, and Claude Code skills

# Core Topics

RosyGameStudio RosyGameStudio
[20]
[0]
Updated: 3/2/2026

Agent Capability Analysis

The forge-mesh-loading skill by RosyGameStudio is an open-source community AI agent skill for Claude Code and other IDE workflows, helping agents execute tasks with better context, repeatability, and domain-specific guidance. Optimized for gamedev, graphics-programming, sdl-gpu.

Ideal Agent Persona

Perfect for Graphics Agents needing advanced 3D model rendering capabilities with SDL's GPU API and Wavefront OBJ files.

Core Value

Empowers agents to load and render textured 3D meshes with camera support, parsing vertex positions, normals, and UV coordinates from OBJ files using real-time graphics programming techniques.

Capabilities Granted for forge-mesh-loading

Loading 3D models from OBJ files for interactive simulations
Rendering textured meshes with camera support for immersive experiences
Parsing 3D model data for physics engine integration

! Prerequisites & Limits

  • Requires SDL's GPU API and Wavefront OBJ file support
  • Builds on prior knowledge of textures, mipmaps, depth, and camera handling
Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

forge-mesh-loading

Install forge-mesh-loading, an AI agent skill for AI agent workflows and automation. Works with Claude Code, Cursor, and Windsurf with one-command setup.

SKILL.md
Readonly

Mesh Loading — OBJ Parsing, Textured Rendering, Camera

This skill teaches how to load and render 3D models from Wavefront OBJ files. It builds on textures-and-samplers (Lesson 04), mipmaps (Lesson 05), depth-and-3d (Lesson 06), and camera-and-input (Lesson 07).

When to use

  • Loading 3D models from OBJ files
  • Rendering textured meshes with a camera
  • Parsing vertex positions, normals, and UV coordinates from files
  • Setting up non-indexed rendering (de-indexed vertices)
  • Combining texture loading + mipmaps + depth testing + camera in one app

Key API calls (ordered)

  1. forge_obj_load(path, &mesh) — parse OBJ into de-indexed vertex array
  2. SDL_CreateGPUBuffer + transfer upload — upload vertices to GPU
  3. SDL_LoadSurface + SDL_ConvertSurface — load PNG texture
  4. SDL_CreateGPUTexture with SAMPLER | COLOR_TARGET — mipmapped texture
  5. SDL_GenerateMipmapsForGPUTexture — auto-generate mip chain
  6. SDL_CreateGPUSampler — trilinear, REPEAT address mode
  7. SDL_CreateGPUGraphicsPipeline — 3 vertex attributes, depth test, back-face cull
  8. SDL_BindGPUFragmentSamplers — bind diffuse texture + sampler
  9. SDL_DrawGPUPrimitives — non-indexed draw (de-indexed vertices)

Libraries

c
1#include "obj/forge_obj.h" /* OBJ parser */ 2#include "math/forge_math.h" /* vectors, matrices, quaternions */

Code template

Loading the mesh

c
1/* Build path relative to executable */ 2const char *base_path = SDL_GetBasePath(); 3char obj_path[512]; 4SDL_snprintf(obj_path, sizeof(obj_path), "%smodels/model.obj", base_path); 5 6ForgeObjMesh mesh; 7if (!forge_obj_load(obj_path, &mesh)) { 8 SDL_Log("Failed to load model"); 9 return SDL_APP_FAILURE; 10} 11 12/* Upload to GPU vertex buffer via transfer buffer */ 13Uint32 vertex_data_size = mesh.vertex_count * (Uint32)sizeof(ForgeObjVertex); 14/* ... standard transfer buffer pattern from Lesson 02 ... */ 15 16Uint32 mesh_vertex_count = mesh.vertex_count; 17forge_obj_free(&mesh); /* CPU-side data no longer needed */

Loading texture with mipmaps

c
1SDL_Surface *surface = SDL_LoadSurface(tex_path); 2SDL_Surface *converted = SDL_ConvertSurface(surface, SDL_PIXELFORMAT_ABGR8888); 3SDL_DestroySurface(surface); 4 5int num_levels = (int)forge_log2f((float)converted->w) + 1; 6 7SDL_GPUTextureCreateInfo tex_info; 8SDL_zero(tex_info); 9tex_info.type = SDL_GPU_TEXTURETYPE_2D; 10tex_info.format = SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB; 11tex_info.usage = SDL_GPU_TEXTUREUSAGE_SAMPLER | SDL_GPU_TEXTUREUSAGE_COLOR_TARGET; 12tex_info.width = converted->w; 13tex_info.height = converted->h; 14tex_info.num_levels = num_levels; 15/* ... upload base level, then: */ 16SDL_GenerateMipmapsForGPUTexture(cmd, texture);

Vertex layout (3 attributes)

c
1/* ForgeObjVertex: position (float3) + normal (float3) + uv (float2) */ 2 3vertex_attributes[0].location = 0; /* TEXCOORD0 = position */ 4vertex_attributes[0].format = SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3; 5vertex_attributes[0].offset = offsetof(ForgeObjVertex, position); 6 7vertex_attributes[1].location = 1; /* TEXCOORD1 = normal */ 8vertex_attributes[1].format = SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3; 9vertex_attributes[1].offset = offsetof(ForgeObjVertex, normal); 10 11vertex_attributes[2].location = 2; /* TEXCOORD2 = uv */ 12vertex_attributes[2].format = SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2; 13vertex_attributes[2].offset = offsetof(ForgeObjVertex, uv);

Rendering (non-indexed)

c
1SDL_BindGPUVertexBuffers(pass, 0, &vertex_binding, 1); 2 3SDL_GPUTextureSamplerBinding tex_binding; 4SDL_zero(tex_binding); 5tex_binding.texture = diffuse_texture; 6tex_binding.sampler = sampler; 7SDL_BindGPUFragmentSamplers(pass, 0, &tex_binding, 1); 8 9/* Non-indexed draw — de-indexed vertices, every 3 form a triangle */ 10SDL_DrawGPUPrimitives(pass, mesh_vertex_count, 1, 0, 0);

HLSL shaders

Vertex shader:

hlsl
1cbuffer Uniforms : register(b0, space1) { column_major float4x4 mvp; }; 2 3struct VSInput { 4 float3 position : TEXCOORD0; 5 float3 normal : TEXCOORD1; 6 float2 uv : TEXCOORD2; 7}; 8 9struct VSOutput { 10 float4 position : SV_Position; 11 float2 uv : TEXCOORD0; 12}; 13 14VSOutput main(VSInput input) { 15 VSOutput output; 16 output.position = mul(mvp, float4(input.position, 1.0)); 17 output.uv = input.uv; 18 return output; 19}

Fragment shader:

hlsl
1Texture2D diffuse_tex : register(t0, space2); 2SamplerState smp : register(s0, space2); 3 4float4 main(float4 pos : SV_Position, float2 uv : TEXCOORD0) : SV_Target { 5 return diffuse_tex.Sample(smp, uv); 6}

Common mistakes

  1. Forgetting UV flip — OBJ uses V=0 at bottom; GPU uses V=0 at top. The forge_obj.h parser handles this automatically (1.0 - v).

  2. Using indexed draw for de-indexed mesh — Use SDL_DrawGPUPrimitives, not SDL_DrawGPUIndexedPrimitives, since vertices are already expanded.

  3. Wrong pixel formatSDL_LoadSurface may return any format. Always convert to SDL_PIXELFORMAT_ABGR8888 for GPU R8G8B8A8.

  4. Missing COLOR_TARGET usage — Required for mipmap generation. Without it, SDL_GenerateMipmapsForGPUTexture silently fails.

  5. Not copying model files in CMake — The OBJ and texture must be next to the executable. Use add_custom_command(POST_BUILD ...) to copy them.

  6. Loading JPGSDL_LoadSurface only supports BMP and PNG. Convert JPG textures to PNG first (e.g. with Python Pillow).

CMakeLists.txt pattern

cmake
1# Copy model files next to executable 2add_custom_command(TARGET my-target POST_BUILD 3 COMMAND ${CMAKE_COMMAND} -E make_directory 4 $<TARGET_FILE_DIR:my-target>/models/model-name 5 COMMAND ${CMAKE_COMMAND} -E copy_if_different 6 ${CMAKE_CURRENT_SOURCE_DIR}/models/model-name/model.obj 7 $<TARGET_FILE_DIR:my-target>/models/model-name/model.obj 8 COMMAND ${CMAKE_COMMAND} -E copy_if_different 9 ${CMAKE_CURRENT_SOURCE_DIR}/models/model-name/texture.png 10 $<TARGET_FILE_DIR:my-target>/models/model-name/texture.png 11)

References

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is forge-mesh-loading?

Perfect for Graphics Agents needing advanced 3D model rendering capabilities with SDL's GPU API and Wavefront OBJ files. Learn real-time graphics programming and build games with SDL's GPU API. Tutorials, code examples, and Claude Code skills

How do I install forge-mesh-loading?

Run the command: npx killer-skills add RosyGameStudio/forge-gpu/forge-mesh-loading. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for forge-mesh-loading?

Key use cases include: Loading 3D models from OBJ files for interactive simulations, Rendering textured meshes with camera support for immersive experiences, Parsing 3D model data for physics engine integration.

Which IDEs are compatible with forge-mesh-loading?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for forge-mesh-loading?

Requires SDL's GPU API and Wavefront OBJ file support. Builds on prior knowledge of textures, mipmaps, depth, and camera handling.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add RosyGameStudio/forge-gpu/forge-mesh-loading. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use forge-mesh-loading immediately in the current project.

Related Skills

Looking for an alternative to forge-mesh-loading or another community skill for your workflow? Explore these related open-source skills.

View All

widget-generator

Logo of f
f

f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy.

149.6k
0
AI

flags

Logo of vercel
vercel

flags is a Next.js feature management skill that enables developers to efficiently add or modify framework feature flags, streamlining React application development.

138.4k
0
Browser

zustand

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI

data-fetching

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI