LibGDX drawPixel has Wrong Colours

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 :-)

One thought on “LibGDX drawPixel has Wrong Colours

  1. Thank you so much for posting this!
    I had the same issue and I almost went nuts!


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to top