Page 1 of 1

CGapiSurface vs. CGapiRGBASurface

PostPosted: Sep 29, 2003 @ 11:32pm
by sunbeam60

PostPosted: Sep 29, 2003 @ 11:34pm
by sunbeam60

PostPosted: Sep 30, 2003 @ 7:33am
by Johan

PostPosted: Sep 30, 2003 @ 8:27am
by sunbeam60

PostPosted: Dec 2, 2006 @ 6:52pm
by Bunkai
Hello,

I tried to summarize, what to do to get the best possible performance using AlphaBlending. Summarizing the information from manual, I get the following:

1. AlphaBlt() is slower than AlphaBltFast(), because it offers rotations and scaling. However, AlphaBlt() works best with RGBASurfaces.

2. On the other hand, AlphaBltFast() is much faster than AlphaBlt(), and AlphaBltFast() works best with separate RGB and Alpha surfaces.

Does that mean, that if I wan to achieve the maximum possible speed with AlphaBlended sprites, should I use separate RGB surfaces with AlphaBltFast() and forget about convenient RGBA surfaces?

Thank you very much,
with regards, Rene.

PostPosted: Dec 3, 2006 @ 1:41pm
by Johan

PostPosted: Dec 3, 2006 @ 3:37pm
by Bunkai

PostPosted: Dec 4, 2006 @ 9:59am
by Bunkai
I studied this subject a bit more. I think the maximum speed gained from two separate files is because Alpha value is stored in RGB format too in the second file. Therefore, RGB can simply get multiplied by alpha without any precomputations.

I can use separate buffers, one for alpha value and one for RGB, if it helps to gain some speed. However, I would like to know, if I can use single transparent PNG file to load RGB and ALPHA value (using GDSURFACE_ALPHA), or if I get faster resutls by loading Alpha value from separate file, where alpha is stored as RGB. If that helps, I will enerate two separate files directly from photoshop: one for RGB and another for Alpha.

Thank you very much,
have a nice day,
Rene.