emscripten icon indicating copy to clipboard operation
emscripten copied to clipboard

drawArrays buffer error on compiled opengl code

Open chaihahaha opened this issue 9 months ago • 1 comments

Version of emscripten/emsdk: emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.7-git clang version 21.0.0git Target: wasm32-unknown-emscripten Thread model: posix InstalledDir: /opt/homebrew/Cellar/emscripten/4.0.7/libexec/llvm/bin

Failing command line in full:

git clone https://github.com/timhutton/opengl-canvas-wasm.git

cd opengl-canvas-wasm

emcc main.cpp -std=c++11 -s WASM=1 -s USE_SDL=2 -O3 -o index.js

python -m http.server 8888

Then open localhost:8888, the triangle is not normally shown, only a black rectangle is shown(127.0.0.1:8888 will work normally)

Full link command and output with -v appended: The following is shown in browser console

WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute

_glDrawArrays @ index.js:1

WebGL: too many errors, no more errors will be reported to the console for this context.

If I visit this webpage from 127.0.0.1:8888, this error will not show up.

If I compile the OpenGL C++ code with older version emcc, this error will not show up.

chaihahaha avatar Apr 19 '25 17:04 chaihahaha

Probably the best way to figure out a regression like this is to bisect,

https://emscripten.org/docs/contributing/developers_guide.html#bisecting

kripken avatar Apr 21 '25 15:04 kripken