how hard to code drawing tools?

Discussion in 'Public Game Developers Forum' started by Planetman, Aug 14, 2014.

  1. Planetman

    Planetman Well-Known Member

    May 3, 2014
    146
    0
    0
    I
    Was wondering how hard it was to code, drawing tools such as air brush etc?
     
  2. Blackharon

    Blackharon Well-Known Member

    Mar 15, 2010
    978
    0
    16
    Game Designer for Ludia
    Canada
    ranging from simple (see most toddler apps) to crazy hard (see paper by 53)
     
  3. Planetman

    Planetman Well-Known Member

    May 3, 2014
    146
    0
    0
    #3 Planetman, Aug 14, 2014
    Last edited: Aug 14, 2014
    paper

    What is paper by 53?


    I guess draw something would be crazy hard category?

    I don't really need super advanced tools sort of in the middle of that
     
  4. Blackharon

    Blackharon Well-Known Member

    Mar 15, 2010
    978
    0
    16
    Game Designer for Ludia
    Canada
  5. Destined

    Destined Well-Known Member

    Aug 11, 2013
    1,063
    0
    0
    this really depends. I did some tests with this and it is a fun area of coding. It depends what you are doing, but there are some libraries to help you out depending if you do a little research.

    It is interesting the cost of draw something.
     
  6. OnlyJoe

    OnlyJoe Well-Known Member

    Sep 29, 2013
    114
    0
    0
    Auckland
    So I have actually tried to do this a little with some photo apps I started working on, I found a pretty basic tutorial on it here:

    http://www.raywenderlich.com/18840/how-to-make-a-simple-drawing-app-with-uikit

    But the real problem is when you get larger images. If you want to allow people to draw on full resolution photos, you can't use the method above. It just uses too much memory and goes way to slow, because you are basically making a very large context that is getting redrawn every time you do something, and the apple libraries don't seem to be designed for this. So the above method works ok if you only want something the same resolution as the screen, but larger sizes you need to use OpenGL to do it.

    So the challenge with OpenGL is the max texture size (1024x1024 on lower devices), so I had to make some code that splits an image into segments, and then wrote another layer above this to paint with (which is basically rending a whole lot of point sprites onto a texture) this actually seems to work really fast. Then you can just change the fragment shaders to produce different brushes. What you can also do is create different texture layers, that can be blended together, creating something like the layers in photoshop. This approach is fast, and has a low memory footprint compared to trying to use a UIView directly. I mean it is still a lot of memory when dealing with big images, but this is the best way I have found.
     

Share This Page