#Using WGPU to Draw Sprites

12 messages · Page 1 of 1 (latest)

twilit flame
#

Hey all!

After a day and a bit of searching and reading through documentation, I'm unfortunately still struggling to use WGPU. I'm aware it's considerably low level and doesn't offer up a lot of high level abstraction (this could be misinformed, but appears true from what I've seen so far). But this has made using it as a novice quite challenging.

Although they're not comparable in a lot of ways because SDL2 is written in C and WGPU is Rust native, still I've had more success using SDL2 so far (although my preference is to use WGPU).

Would anyone be able to point me into the right direction please for achieving my goal to use WGPU for drawing sprites?

The material's I've been using for guides: learn-wgpu, the wgpu docs and program examples via wgpu github repo.

Any & all help much obliged, thank-you!

tribal imp
#

From a GPU perspective, sprites are just textured quads. Quads are just two triangles. So, you have one "mesh" but many textures. That's all there is to it, really.

twilit flame
#

Hey kpreid, thank-you for the reply. I appreciate that it's relatively straight forward in description but I'm struggling to use wgpu to build a framework; which I understand is typically what somebody will be using it for. I'm probably going to continue using SDL2 /w Rust instead for the time being, as it already provides a few high level abstractions making it easier for a total gfx programming noob like me to use.

Overall, I am feeling a bit defeated by this as I really wanted to use WGPU but I think it's something I'll need to come back to when I've got more experience. Cheers!

hardy palm
#

this has some useful examples of rendering sprites and Text

#

here is the area you can see how the sprite's pipeline is setup

#

here is the shader

#

there is also a texture loader and handler.