Open Davidobot opened 3 years ago
Not as trivial as I thought...
Had to edit OpenGL::rawTexStorage
to contain
#if !defined(LOVE_EMSCRIPTEN)
if (fmt.swizzled)
{
glTexParameteri(gltarget, GL_TEXTURE_SWIZZLE_R, fmt.swizzle[0]);
glTexParameteri(gltarget, GL_TEXTURE_SWIZZLE_G, fmt.swizzle[1]);
glTexParameteri(gltarget, GL_TEXTURE_SWIZZLE_B, fmt.swizzle[2]);
glTexParameteri(gltarget, GL_TEXTURE_SWIZZLE_A, fmt.swizzle[3]);
}
#endif
and include extra linker arguments:
"-s MAX_WEBGL_VERSION=2" # build for WebGL 2.0
"-s USE_WEBGL2=1"
"-s FULL_ES3=1" # needed for WebGL 2.0
Looks like WebGL2.0 doesn't support swizzling, hence the really bizarre colour scheme.
Seems to affect fonts primarily.
You should just be able to add an extra check here so the RG8 codepath doesn't run on webgl: https://github.com/love2d/love/blob/c8e7d4e28a060d8e9f13b7fee549cf270995360a/src/modules/graphics/opengl/OpenGL.cpp#L1454
Should be as simple as adding
-s MAX_WEBGL_VERSION=2