allegro5
allegro5 copied to clipboard
WebGL warning
Hi there,
I'm exploring allegro to build with emscripten for WebGL and I'm encountering these errors ( / warnings ) when drawing primitives:
WebGL warning: vertexAttribPointer: If ARRAY_BUFFER is null, byteOffset must be zero.
WebGL warning: drawArraysInstanced: Vertex attrib array 0 is enabled but has no buffer bound.
(Clearing to color works fine)
I'm building with:
USE_FLAGS="-s USE_SDL=2 -s USE_LIBPNG=1 -s FULL_ES2=1 -s ASYNCIFY -s TOTAL_MEMORY=2147418112 -O3"
emcmake cmake .. \
-D CMAKE_BUILD_TYPE=Release \
-D ALLEGRO_SDL=ON \
-D EMSCRIPTEN=ON \
-D SHARED=OFF \
-D WANT_MONOLITH=ON \
-D WANT_ALLOW_SSE=OFF \
-D WANT_IMAGE=OFF \
-D WANT_VIDEO=OFF \
-D WANT_AUDIO=OFF \
-D WANT_DOCS=OFF \
-D WANT_TESTS=OFF \
-D WANT_EXAMPLES=OFF \
-D WANT_WAIT_EVENT_SLEEP=ON \
-D SDL2_INCLUDE_DIR=$EM_CACHE/sysroot/include \
-D CMAKE_C_FLAGS="${USE_FLAGS}" \
-D CMAKE_CXX_FLAGS="${USE_FLAGS}" \
-D CMAKE_EXE_LINKER_FLAGS="${USE_FLAGS}" \
-D CMAKE_EXECUTABLE_SUFFIX_CXX=".html"
emmake make && emmake make install
(here i'm removing LIBPNG to use emscripten's)
I've also tried without the -D EMSCRIPTEN=ON
.
Not sure if this is prioritary though.
Not sure if it has something to do with SDL2 or OpenGL ES2.
Let me know if there is anything I'm doing wrong here.
Cheers
Are you using shaders? WebGL has some differences there you'll need to account for.
Share a small repro where you run into this and I'll see if I can help.
Also if you are using a bash shell, your build script is very subtly wrong. See #1319 / see the latest instructions https://github.com/liballeg/allegro5/blob/master/README_sdl.txt Possibly you aren't really passing FULL_ES2
to emscripten so aren't getting full webgl compatibility. To confirm, put an echo
just before emcmake command