LibGDX drawPixel has Wrong Colours

Posted by in Software

TL;DR: Note that Pixmap.drawPixel(x, y, colour) expects a RGBA8888 colour, even if the pixmap is not RGBA8888.

Today I wanted to create a background with a bunch of different pixels and I had a lot of problems, displaying different colours from what I had in my array.

The process is simple: Pixmap > Texture > Sprite, with the colours being filled up in the pixmap using Pixmap.drawPixel(x, y, colour).

My Pixmap was created as RGB888, so I expected to draw the pixel with a RGB888 colour.

NO! you need RGBA888!


At the end of the day is not such a big deal, because all I needed to do was to change:



A little experiment: If you find this post and ad below useful, please check the ad out 🙂