Page 1 of 1

Blitting a color keyed surface on the display

PostPosted: Nov 10, 2010 @ 3:34am
by Nacho84
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

Re: Blitting a color keyed surface on the display

PostPosted: Nov 16, 2010 @ 3:05pm
by edge
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