There's plenty of abstraction libraries available including for example webgpu. Why do you want immediate mode specifically? It's not a very useful balance to strike between just using an actual 2d library vs. learning how shaders work which you're going to need for anything slightly non-trivial