Fun on a saturday evening

Guess who’s back from a trip and is also done with school? Yup, you guessed it, it’s me. The good thing that is that I have time to work on side projects now. Which also means posting more often(hopefully).

So last saturday evening I had some free time and was bored a bit. So I decided to boot up Visual Studio and have some fun. I’ve been wanting to do some image manipulation for some time. Very basic image manipulation. I got inspired by how the old console managed to used the same texture in multiplayer games, while having distinct colors. So I thought, why not try something where I can select the color of an image and change it. And this is what I’ve done with TexCol.

TexCol as it is right now

As it is right now, TexCol allow to load an image given as an argument, select a color from the image by clicking on it and change the occurence of that color on the image with a new color selected through an ImGui window. The way it works behind is very simple. It makes a copy of the current texture, replace every pixel it finds that match de original selected color by the new color, replace the old texture with the now modified texture and voila. Nothing really complicated. The system works using SFML and ImGui and is a single source file.

Where I want it to go

There’s a few thing I would really to change with it. First of all, it’s really incovenient that it loads only through an argument passed at launch. It would be nice to have a way to change the image at runtime, inside the application. It would also be nice to be able to save the now modified image. But more than everything, I really want to change the way the application changes the texture. The it is doing it right now is very consuming from a CPU and memory point of view. It’s not really efficient. What I want to do is do this through a shader. This would shift all the computation onto the GPU instead of the CPU and it would be much faster and efficient. After all, GPUs are made for that kind of manipulation. It would also be a nice exerice and learning experience for me. I do intend of changing the code soon so it works with a shader.

If you’re interested in the code, you can find it here, on my GitHub.

Have a nice evening!

TexCol