View Full Version : Adequate option for painting app

04-27-2012, 09:41 AM
Hi, just registered in hope that someone can give me some direction. I'm making a painting app for myself using OpenGL . I already have it working with some standard features such as layered painting, erasing, undo redo etc. But i came to a problem with layers and erasing. I used an FBO with multiple texture attachments for each layer and Blending for erase. I'm sure it's not the best solution, i couldn't find any references for that so i came with that solution by my own. Two problems: Isn't using multiple textures for each layer a bit much ? And about erasing , if i paint with color A on point X than with color B on the same point and set erase blend (ZERO, ONE_MINUS_SRC_ALPHA currently ) and paint on that point it'll erase everything of course , thus , it's not adequate for the case. So i thought about painting to main framebuffer instead, storing a list of points to draw, removing that FBO system entirely, and handling layers and erasing differently. Erasing than could be just a matter of deleting a point from list. Would that be more adequate for my case ? Or is should i stay with my FBO system and handle erasing differently ? Any tips ? An observation : It's a grid based paint app (pixel art painter) so if my image is 640x480 and my pen size is 16x16 there will be 40*30 = 1200 points.

Thanks !

04-27-2012, 11:59 PM
Indeed for such low number of points it make sense to simply keep a list in memory (like a vector editor) for currently modified layer.
For performance reasons, and with a large number of layers, it can be useful to keep an FBO for each layer which is not currently modified.

04-28-2012, 08:49 AM
Thanks for the tip !

04-28-2012, 12:30 PM
One thing comes to mind: Is it possible to have layers with only one texture ?