Hey everyone,

Basically the title. I’d like to learn how to make my own drawing program and I’m slightly surprised that I can’t seem to find anything about it. No tutorials or discussions about requirements or just general tutorials.

Does anyone have any recommendations on where I could start?

  • 0t79JeIfK01RHyzo@lemmy.ml
    link
    fedilink
    English
    arrow-up
    7
    ·
    9 days ago

    Since you posted in /c/rust@programming.dev, I’ll give an answer for Rust.

    When thinking about rendering, there are mostly 2 ways to complete it

    1. You handle setting pixels (usually rgba) at x and y coordinates
    2. You use a graphics toolkit that handles rendering commonly used drawing methods. Like rendering circles of a specific size, rendering a line between 2 points, etc.

    For 1, the crate pixels provides rendering to x and y coordinates with the CPU to window. If you’re doing lots of operations, you’ll probably find this too slow, and not fast enough. To solve this problem, people use a GPU instead with shaders. vulkano-rs is a good, wgpu is also good.

    For 2, I don’t have immediate recommendations, but you can usually find these types of toolkits with game engines. As an example, bevy has an example of rendering shapes.

    It also just depends where you want to render. If you’re limited to in the browser, you’ll find that maybe vulcano won’t work, and you’ll have to use something like WebGPU instead. Or maybe you’re restricted to an environment where a web browser can’t be used, so WebGPU can’t be used, and Vulkano has to be how you complete it. Maybe you can’t use a GPU, and need to render directly to a canvas on web page in the browser, then you can just use the MSDN docs for the canvas. etc.

    • soulsource@discuss.tchncs.de
      link
      fedilink
      arrow-up
      3
      ·
      8 days ago

      For 2) I’d also suggest to check out SDL. There are excellent SDL bindings for Rust, and it’s way less involved than dragging in a fully-featured game engine.

    • ChocolateFrostedSugarBombs@lemmy.worldOP
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      8 days ago

      Yeah I think i’m leaning more toward the GPU/shader side of things so I’ll take a look at the vulkano-rs and wgpu. I assume vulkano-rs is the rust implementation of the vulcan API?

      And it’s funny you bring up Bevy, I was playing around with the idea of using Bevy or Godot as my wrapper. I have a lot of experience with Unity and I’m pretty comfortable with game engines but I’ve never used Unity ECS nor have I used Godot/Bevy specifically. I do like the idea of making a drawing app with a game engine as impractical as that may be lol.

      I don’t want it limited to the browser. I was more wanting to make a full standalone application to run on the desktop. I also want to incorporate touch and leverage the GPU. So it sounds like vulkano-rs might be the thing to look into.

      EDIT: Forgot to mention that yeah, I’m looking at Rust for now but do you have a recommendation for other programming languages?