Alpha-blended shapes were rendering nearly invisible due to incorrect
blend function configuration in two places:
1. FBO rendering (webgl_gal.cpp): Changed to glBlendFuncSeparate to handle
RGB and alpha channels independently. Alpha channel now accumulates
coverage correctly (prevents it from staying near 0.0 when rendering
with alpha=0.5).
2. Compositor (webgl_compositor.cpp): Changed from premultiplied alpha
blend (GL_ONE, GL_ONE_MINUS_SRC_ALPHA) to straight alpha blend
(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) since our FBOs use straight alpha.
Also marked Transform() as dead code with explanation - never called in
KiCad and has no effect even in native OPENGL_GAL.
Result: Alpha-blending scenario now renders correctly with proper color
mixing for overlapping shapes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fix coordinate system for 1:1 pixel mapping (was using nm scale)
- Set worldUnitLength to 1/96 to match native test setup
- Add SetLookAtPoint and SetZoomFactor for proper view transformation
- Fix glDrawBuffers for WebGL 2.0 (array index must match attachment)
- Add legacy_gl_stubs.js for wxWidgets compatibility
- Add isReady() check to prevent race condition in Playwright tests
All 28 GAL test scenarios now render correctly in WebGL.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Major refactoring to remove ALL legacy OpenGL immediate mode calls from
WEBGL_GAL and replace them with WebGL 2.0/OpenGL ES 3.0 compatible code.
Key changes:
- Add MVP matrix uniform support (replaces glMatrixMode/glOrtho/glLoadMatrix)
- Add matrix math helpers (computeOrthoMatrix, multiplyMatrix4x4, etc.)
- Replace glBegin/glEnd/glVertex with vertex manager pattern
- Rewrite DrawCursor to use vertex manager and DrawLine() calls
- Rewrite DrawBitmap to use vertex manager with SHADER_FONT mode
- Replace glEnableClientState with glVertexAttribPointer
- Replace glDrawBuffer with glDrawBuffers (WebGL 2.0 API)
- Add fullscreen_quad.cpp/h for compositor Present()
- Update SHADER class with mat4 uniform support
- Add MultiplyMatrix() to vertex_manager for Transform()
- Remove all legacy GL stubs from wasm_stubs.cpp
Build now completes with FULL_ES3 mode (no LEGACY_GL_EMULATION).
Remaining issue: wxWidgets GL library calls glColor3f internally.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy and adapt OpenGL GAL to WebGL:
- Copy all OpenGL GAL source files to tests/gal-regression/wasm/webgl/
- Rename classes from OPENGL_* to WEBGL_*
- Add kiglew.h with WebGL2/GLES3 headers and GLEW stubs
- Add webgl_antialiasing.h/cpp adapted for WEBGL_COMPOSITOR
- Add shader generator (generate_shaders.py) for WASM build
- Update Makefile with all KiCad dependencies (C++20, GLM, clipper2, etc.)
Build produces 544KB JS + 4.9MB WASM. Tests run but render blank
(expected - GL context initialization needs WebGL adaptation).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>