- Fix immediate mode (glBegin/glEnd) by using color-per-vertex pattern - Document Emscripten's requirement for color per vertex in GL_README.md - Add OpenGL test tab with visual rendering verification - Test GL_TRIANGLES, GL_QUADS, GL_LINES, GL_LINE_STRIP, GL_LINE_LOOP - Update wxwidgets submodule with improved context management Key finding: Emscripten's LEGACY_GL_EMULATION requires glColor*() to be called before EACH glVertex*() call, not using OpenGL's "current color" semantic. This is because the stride calculation expects interleaved vertex data with color per vertex. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
41 lines
1.3 KiB
Text
41 lines
1.3 KiB
Text
# Makefile for wxWidgets WASM test app with OpenGL support
|
|
# Uses the local wxWidgets build with legacy GL emulation
|
|
|
|
WXCONFIG = ../../build-wasm/wxwidgets-universal/wx-config
|
|
TOOLS_ROOT = ../../wxwidgets/build/wasm
|
|
|
|
CXX = em++
|
|
WX_CXXFLAGS := $(shell $(WXCONFIG) --cxxflags)
|
|
# Include GL library for OpenGL tests
|
|
WX_LDFLAGS := $(shell $(WXCONFIG) --libs base,core,gl)
|
|
|
|
TARGET = minimal_test
|
|
SOURCES = minimal_test.cpp
|
|
|
|
CXXFLAGS = -O2 $(WX_CXXFLAGS)
|
|
|
|
# Emscripten flags:
|
|
# -sLEGACY_GL_EMULATION: Enable legacy OpenGL (glBegin/glEnd, etc.) emulation on WebGL
|
|
# -sMAX_WEBGL_VERSION=2: Enable WebGL 2.0 support (required since wxGLCanvas requests WebGL 2)
|
|
# Note: Cannot combine LEGACY_GL_EMULATION with FULL_ES2 - they are mutually exclusive
|
|
EM_GL_FLAGS = -sLEGACY_GL_EMULATION -sMAX_WEBGL_VERSION=2
|
|
|
|
LDFLAGS = -sALLOW_MEMORY_GROWTH -sERROR_ON_UNDEFINED_SYMBOLS=0 \
|
|
-s "EXPORTED_RUNTIME_METHODS=['HEAPU8','HEAP8','HEAP32']" \
|
|
$(EM_GL_FLAGS) $(WX_LDFLAGS)
|
|
|
|
JS = $(TOOLS_ROOT)/wx.js
|
|
HTML = $(TOOLS_ROOT)/template.html
|
|
|
|
all: $(TARGET).html
|
|
|
|
$(TARGET).o: $(SOURCES)
|
|
$(CXX) -c $(CXXFLAGS) $< -o $@
|
|
|
|
$(TARGET).html: $(TARGET).o
|
|
$(CXX) $(TARGET).o $(LDFLAGS) --pre-js $(JS) --shell-file $(HTML) -o $@
|
|
|
|
clean:
|
|
rm -f $(TARGET).o $(TARGET).html $(TARGET).js $(TARGET).wasm
|
|
|
|
.PHONY: all clean
|