Transparency with bitmap resource as a texture

Started by
10 comments, last by SERPENT 20 years ago
i won`t go into details but i list here in pseudo code what i did to get it working.

struct rgba{
byte a, r, g, b
}
alpha_bitmap:
load_data_from_bitmap // whatever source
alloc_memory ( size = width*height*sizeof (rgba) )
loop y
loop x
if pixel (x,y) == alpha_color then
write_pixel (255, 255, 255, 0) // 0=alpha
else
write_pixel (r, g, b, 255) // rgb from pixel(x,y)
done
done
glTexImage2D (...)
done

i hope this helps. use a structure like rgba and then just consider the memory like a 2d-array of those structure elements.

Life's like a Hydra... cut off one problem just to have two more popping out.
Leader and Coder: Project Epsylon | Drag[en]gine Game Engine

Advertisement
I got it already, about this morning at 2am. thanks alot guys
http://www.WoodmanStudios.tk

This topic is closed to new replies.

Advertisement