2D Transparency

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Fhqwhgads
Posts: 42
Joined: Tue Jun 21, 2005 1:43 am

2D Transparency

Post by Fhqwhgads »

Ok, I have a simple black and white image with a X and a O. When I go to draw them, the X isn't transparent. The transparent part of the image is black, but on the O it is transparent. Color to be transparent is white.

Problem
Image


Load

Code: Select all

	tXO = driver->getTexture("./graphics/xo.bmp");
	driver->makeColorKeyTexture(tXO,SColor(255,255,255,255));
Draw

Code: Select all

driver->draw2DImage(tXO,position2d<s32>((u*30)+16,(i*30)+9),rect<s32>(0,0,19,16));
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

I think a search on the forum would help...

maybe try to use a pixle instead of a color for setting the transparent color:

Code: Select all

driver->makeColorKeyTexture(tXO, position2d<s32>(x, y));
x and y are the position of a transparent pixle...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
alc
Posts: 31
Joined: Sun Jun 25, 2006 10:59 pm
Location: Denmark

Post by alc »

Probably, the color you think is white in our image isn't quite white. If the color values are, say, (254,254,254,254) you could never visually tell the difference, but Irrlicht can :)
Post Reply