PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Blitting a color keyed surface on the display

Hi! I've got a simple question: How can I blit a color keyed 2D surface to the display? I've been scanning through the documentation and none of the available blit functions in ClassEDisplay (ie. Blt, BltFast and BltFx) seem to have the capability of doing that. I'm aware I can use the Blt and BltFast methods from the display's buffer field, but since I'm using OpenGL I cannot do that.

Cheers,

--Nacho
Hi Nacho,

If your app supports both software rendering and OpenGL, you'll need to handle color keying in two different ways:
- Set the colorkey of the surface before uploading it to OpenGL. In the UploadTexture call, set 'upload as rgba' to true
- Use display->SetShading(E3D_TEXTURE | EFX_COLORKEY) before using any blitting calls in software rendering mode

You can use any of these two methods in the same codebase, without having to use preprocessor macro's like #ifdef

Johan