Hacker News new | past | comments | ask | show | jobs | submit login

You may already know this, but for WebGL you should use ANGLE. It's what the browsers mostly use and will guarantee compatibility across platforms. Trying to implement the WebGL API over desktop GL yourself will be a never ending black hole of issues. https://chromium.googlesource.com/angle/angle/+/main/README....



Thanks for the hint!

Do you happen to be familiar with ANGLE? What happens if I just expose GLES 3.0 bindings as WebGL2 based on the native drivers on each platform?

(my earlier understanding was that ANGLE was a WebGL-to-Direct3D translation layer, for compat on Windows.)


Most desktop platforms unfortunately don't provide a native GLES driver, so you'd have to translate desktop GL to GLES. This is harder than it sounds, if you care about getting everything right. ANGLE handles that for you. Additionally it contains dozens of workarounds for serious driver issues on various platforms. And implementations of WebGL extensions that differ from GL/GLES extensions.

In addition to all that, it does let you use DirectX on Windows instead of GL (and Metal on Mac and Vulkan wherever). The reason you want that is that many Windows PCs do not have a GL driver installed. Microsoft does not ship one, so if the OEM didn't install one and the user didn't install one then it simply doesn't exist. And even when the GL driver is installed, it is often buggier than the DirectX driver. Similarly on Mac, GL is buggier than Metal (and officially deprecated).


> Most desktop platforms unfortunately don't provide a native GLES driver, so you'd have to translate desktop GL to GLES.

This is somewhat less true than it used to be since one of the required features of OpenGL 4.3 is GLES 3.0 compatibility. Unfortunately, Mac OS is stuck on GL 4.1 forever (at least until they drop support completely anyway) and the other points you bring up are quite valid.


This is very useful info for everyone aspiring to do cross platform graphics, thanks a ton!


For new development in native cross platform graphics I would recommend Dawn or wgpu-native as a base instead of GL. That will get you excellent portability with a modern style of API.


Could you say more about this? I'm currently trying to learn in this space, and it was my understanding that Skia already uses or can use ANGEL.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: