This example demonstrates using texture2ddecoder-wasm loaded directly from jsDelivr CDN without any build tools.
file:// will cause CORS errors.
# Navigate to the examples directory
cd examples
# Start HTTP server
python -m http.server 8000
# Open in browser
# Visit: http://localhost:8000/cdn-example.html# Install http-server globally (one time)
npm install -g http-server
# Navigate to examples directory
cd examples
# Start server
http-server -p 8000
# Visit: http://localhost:8000/cdn-example.htmlcd examples
php -S localhost:8000
# Visit: http://localhost:8000/cdn-example.html- Install "Live Server" extension in VS Code
- Right-click on
cdn-example.html - Select "Open with Live Server"
- ✅ Zero Installation: No npm packages needed
- ✅ CDN Loading: Library and WASM loaded from jsDelivr
- ✅ Real Texture: Loads and decodes actual 400x400 ETC2 RGBA image
- ✅ Interactive: Test multiple texture formats (BC1, BC3, ETC1, ASTC)
- ✅ Visual Output: Displays decoded images on canvas
- Loads
texture2ddecoder-wasmfrom jsDelivr CDN - Initializes WASM module from CDN
- Provides buttons to test different texture decoders
- "Load Real ETC2 Image" button loads
compressed_etc2_rgba_400x400.binand displays it
Access to fetch at 'file://...' has been blocked by CORS policy
Solution: You're opening the file directly. Use an HTTP server as shown above.
Make sure you're running the server from the examples directory, not the root project directory.
# Wrong - from project root
python -m http.server 8000 # ❌
# Correct - from examples directory
cd examples
python -m http.server 8000 # ✅- Texture Format: ETC2 RGBA (8-bit alpha)
- File Size: ~160KB compressed
- Dimensions: 400x400 pixels
- Output Format: BGRA (4 bytes per pixel)
- Decoded Size: 640KB
For a better development experience with HMR and build tools, try the Vite CDN Example.