emscripten-core / emscripten-core/emscripten

drawArrays buffer error on compiled opengl code

Open
#24,152 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

**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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.