Add GL immediate mode shim for Emscripten compatibility
Create custom JS library (lib/gl_immediate_shim.js) that fixes two Emscripten LEGACY_GL_EMULATION issues without modifying KiCad source: 1. Color-per-vertex requirement: Emscripten requires glColor before each glVertex, but standard OpenGL uses persistent "current color". The shim tracks color state and auto-injects before each vertex. 2. Missing double-precision functions: glVertex2d, glVertex3d, glColor3d, glColor4d are unimplemented in Emscripten (wontfix). The shim provides these as wrappers to float variants. Update test code to use standard OpenGL patterns (color set once, multiple vertices) to verify the shim works correctly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
0db33b10f7
commit
3287ec7616
3 changed files with 222 additions and 45 deletions
|
|
@ -20,9 +20,13 @@ CXXFLAGS = -O2 $(WX_CXXFLAGS)
|
|||
# Note: Cannot combine LEGACY_GL_EMULATION with FULL_ES2 - they are mutually exclusive
|
||||
EM_GL_FLAGS = -sLEGACY_GL_EMULATION -sMAX_WEBGL_VERSION=2
|
||||
|
||||
# GL immediate mode shim - fixes Emscripten's color-per-vertex requirement
|
||||
# and provides missing glVertex2d/glColor4d implementations
|
||||
GL_SHIM = ../../lib/gl_immediate_shim.js
|
||||
|
||||
LDFLAGS = -sALLOW_MEMORY_GROWTH -sERROR_ON_UNDEFINED_SYMBOLS=0 \
|
||||
-s "EXPORTED_RUNTIME_METHODS=['HEAPU8','HEAP8','HEAP32']" \
|
||||
$(EM_GL_FLAGS) $(WX_LDFLAGS)
|
||||
$(EM_GL_FLAGS) --js-library=$(GL_SHIM) $(WX_LDFLAGS)
|
||||
|
||||
JS = $(TOOLS_ROOT)/wx.js
|
||||
HTML = $(TOOLS_ROOT)/template.html
|
||||
|
|
|
|||
Loading…
Reference in a new issue