zeroGL icon indicating copy to clipboard operation
zeroGL copied to clipboard

Support custom pixel formats

Open prcastro opened this issue 2 years ago • 1 comments

We currently support only BGRA32 colors. We should allow users to customize this when using the library.

References:

  • https://wiki.libsdl.org/SDL2/SDL_PixelFormatEnum

prcastro avatar Jan 05 '24 12:01 prcastro

This would be really useful for my project. I'm trying to use ZeroGL as a C-Extension in DragonRuby but DR only accepts ABGR colours. So instead of altering ZeroGL, I post process the pixel array to convert it. However, that's not very efficient. I also noticed that ZeroGL doesn't deal with the Alpha channel in most of the colour functions so I have to force Alpha on. I don't know if this is just a product of the colour format or something else. Thanks.

dcrawl avatar May 21 '24 12:05 dcrawl

Hey @dcrawl, not sure if this is still useful to you, but PR #47 solved this issue. You can now set the pixel format by doing:

#define ZEROGL_PIXELFORMAT ZEROGL_PIXELFORMAT_ABGR8888

Before including zeroGL. More details on the docs.

prcastro avatar Jul 08 '24 23:07 prcastro