emscripten-core / emscripten-core/emscripten

glGetAttribLocation produces exception in WebGL 2.0

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

Description

Setting the vertex attribute index in WebGL 2.0 Context via [glGetAttribLocation](https://docs.gl/es3/glGetAttribLocation) produces the following error, when using two VertexBuffers in a single VertexArrayObject (VAO): ```exception thrown: TypeError: cb is undefined,_glEnableVertexAttribArray@```

In OpenGLES 3.0 environment it doesn't crash.
A workaround is using [glBindAttribLocation](http://docs.gl/es3/glGetAttribLocation) as described in the [following commit.](https://github.com/vkaytsanov/AngryBirds/commit/e85fb1f1986a235031831445a1e6b59026f0bec3#diff-68a5e8e82d828c3451e5ea63bc3201b2d1e983f5bca75766c76ee73389acb790)

```
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.18
clang version 13.0.0 (Cswircachegitchromium.googlesource.com-external-github.com-llvm-llvm--project 94340dd5bb23fb7c4bc7d91d5ac0608eb25660a8)
Target: wasm32-unknown-emscripten
Thread model: posix
```

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.