problem with gun picture overlay[solved]

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
ViperGuy911
Posts: 31
Joined: Tue Apr 12, 2005 12:20 am

problem with gun picture overlay[solved]

Post by ViperGuy911 »

I used the code from the previous post of mine that was answered by trekker. Now, I found a new picture I want to use and use the code with the new gun name and the new R, G, B for the transparency and the picture comes up half and all chopy with the transparency. If you need the code and/or the picture, just tell me and i'll put it up.


Thanks. I used Photoshop C8 to find the background color(it was 30, 60, 205).
Last edited by ViperGuy911 on Mon May 16, 2005 4:38 am, edited 1 time in total.
TheRLG
Posts: 372
Joined: Thu Oct 07, 2004 11:20 pm

Post by TheRLG »

here's what i would do. make an alpha channel in photoshop and u save the file as either a PSD... or another format that has alpha channels. then, use the texture, and enable alpha channel on it in ur code. should look a lil bit better.
ViperGuy911
Posts: 31
Joined: Tue Apr 12, 2005 12:20 am

Post by ViperGuy911 »

I got the part that the picture showes half because I forgot to change the picture size.

I am not good with Photoshop. I have the trial of C8. If I send you the picture would you edit it for me, please?


Thanks
TheRLG
Posts: 372
Joined: Thu Oct 07, 2004 11:20 pm

Post by TheRLG »

this is pretty easy. on the part on the bottom right where it says Layers, there should be a Channels tab. go to that, hit the new channels button on the bottom right of that window, and u should get an alpha channel. now, on that channel, everything that is white will appear and everything that is black will be invisible. so, in ur layers, select everything u want visible, and fill that part in white on the alpha channel only. i suggest u start out by saving this file as something else so u dont mess it alll up.
ViperGuy911
Posts: 31
Joined: Tue Apr 12, 2005 12:20 am

Post by ViperGuy911 »

K. Thx. Pic edit done. How would I set it up in the code. heres my code now

Code: Select all

// Picture stuff
video::ITexture* image = driver->getTexture("m4al.jpg");
driver->makeColorKeyTexture(image,video::SColor(0,0,0,255));

// close device = false
progDeath = false;
while(device->run())

if (device->isWindowActive())
{
driver->beginScene(true, true, video::SColor(255,113,113,133));

smgr->drawAll();

// play gun shot sound
if (fire == true)
{
	sound->setRepeat(false);
	sound->setVolume(0.8f);
	sound->play();
}
//pic stuff
driver->draw2DImage(image, core::position2d<s32>(100,150), 
           core::rect<s32>(0,0,665,375), 0, video::SColor(255,255,255,255), true);

if (progDeath == true)
{
	device->closeDevice();
}

driver->endScene();
}

device->drop();

return 0;
}
Ty
TheRLG
Posts: 372
Joined: Thu Oct 07, 2004 11:20 pm

Post by TheRLG »

ok purrty easy, ur codes fine. but JPG images do not support alpha channels. u have to use PSD (the photoshop format) or the other format that supports alpha channels... im pretty sure its TGA or something, but i dont remember.
Bot_Builder
Posts: 23
Joined: Thu Apr 14, 2005 6:59 pm
Location: Bushland

Post by Bot_Builder »

PNG
ImageXP SP2, AMD Athlon 64 3500+, 1GB HyperX RAM, Radeon X700 Pro (PCI-e), 120GB SATA drive :)
ViperGuy911
Posts: 31
Joined: Tue Apr 12, 2005 12:20 am

Post by ViperGuy911 »

PNG is not a supported format.
RLG not logged

Post by RLG not logged »

just use PSD. u could even just rename it to .WHATEVERIWANT as long as u save it in PSD format, u will have alpha channels.
Guest

Post by Guest »

did u ever get it to work?
ViperGuy911
Posts: 31
Joined: Tue Apr 12, 2005 12:20 am

Post by ViperGuy911 »

No. Sorry, not yet. When I do i'll post it with the person who helped me.
ViperGuy911
Posts: 31
Joined: Tue Apr 12, 2005 12:20 am

Post by ViperGuy911 »

K. Its done. Image

Thanks RabidLockerGnome
Post Reply