I'm looking to use a texture to store single bits (or a low number of bits, two or three). This in of itself isn't hard if you're using nearest neighbor sampling with some bit plane unpacking. The kicker here is I need the values to abide to bilinear interpolation (or something that looks like interpolation), and manually emulating bilinear interpolation is rather slow and potentially prone to problems due to hardware differences.

This is an instance where I'm going to have a lot of similarly-sized textures. The best thing I've come up with is using a 4 x 4-bit channel texture and storing a texture in each channel. This isn't exactly great for texture cache, but it's near native-hardware supported. Unfortunately, this also requires four times the space (4 bits instead of 1 bit per texel) assuming the number of textures I have to store is divisible by 4.

Is there a better way to store 1 bit per texel? Or even 2 bits per texel?


1 Answer 1


You could use compressed textures to store your 1bpp image, they can all store 1bpp images without loss as each tiles can have 2 colors (and in-betweens).

PVRTC supports a 2bpp format, PVRTC is only supported on PowerVR devices.

ETC1 and S3TC (DXT1) are 4bpp which comes back to the same size as 4x4 in RGBA4444 format but you don't need to combine and then separate them, makes the shader code simpler and faster.

ASTC supports down to 0.89bpp, including 2bpp. (ARM Mali GPUs)

But there isn't 1 single compressed format that is usable on all GPUs (ETC2 is standard on OpenGL ES 3.0, not 2.0).

If all you're compressing are 1 bit textures (rather than full blown RGBA8888) its really easy to write a fast texture compressor function as all of those compression formats use a table of colors per cells and the hard part is always figuring out which colors to pick but since you only have 2 colors its really easy and fast.

You'll have to write one function per format so you can check what the OpenGL ES implementation supports and then convert to that format at loading time.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .