This site is no longer active and is available for archival purposes only. Registration and login is disabled.

"lightmap" question


"lightmap" question

Postby Kak » Dec 9, 2008 @ 6:17pm

Hi!

I'm trying to move some of my old code (working with pocketHAL, I had to do everything manually - which I loved ;) ) to EDGELIB to test some things for iPhone (and maybe ppc & smartphone too).

I had a kind of custom "blitLightmap" where I had a gray texture, ranging from 0 to 255, and I used it to produce shadows in 2d backgrounds, kind of 3d lightmap multitexturing but (obviously) in 2d.

128 meant "keep the background color as is", the closer to 0 the darker the background color changed, and closer to 255 would mean to put some light (usually @ 255 it was saturated with white color)

I'm terrible explaining this kind of things, I hope you understood it :)


I loved this method because I used no mults (just shifts & ands to get the R,G,B and a lookup table), and it was pretty fast, but which should be the correct way to do that in EDGELIB? Should I directly use an alpha blit, or is there any way I can make this kind of function run faster?

TIA
Kak
User avatar
Kak
pm Member
 
Posts: 291
Joined: Jul 26, 2003 @ 12:24pm
Location: Zannarkand, Spira


Postby edge » Dec 10, 2008 @ 11:27am

Hi,

For iPhone we recommend using OpenGL, hardware acceleration makes a big difference for this device. You can use the EDGELIB wrappers to draw 2D graphics in OpenGL.

If you can't use OpenGL you can program your routine manually by locking surfaces.

For your example you can also use subtractive blending for the shadow, and additive blending for the lighting. In this case you need to have 2 different surfaces, one for the shadow and one for the light.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby Kak » Apr 18, 2009 @ 10:38am

User avatar
Kak
pm Member
 
Posts: 291
Joined: Jul 26, 2003 @ 12:24pm
Location: Zannarkand, Spira


Postby edge » Apr 18, 2009 @ 1:13pm

EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Return to EDGELIB


Sort


Forum Description

Powerful and affordable C++ middleware solution covering true multi-platform 2D, 3D and network features for Apple iPhone, Windows Mobile, Symbian S60, UIQ, Linux and Windows desktop.

Moderator:

edge

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron