Page 1 of 1
problem with gun picture overlay[solved]
Posted: Sat May 14, 2005 11:21 pm
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).
Posted: Sat May 14, 2005 11:24 pm
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.
Posted: Sat May 14, 2005 11:30 pm
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
Posted: Sat May 14, 2005 11:36 pm
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.
Posted: Sat May 14, 2005 11:52 pm
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
Posted: Sun May 15, 2005 1:39 am
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.
Posted: Sun May 15, 2005 3:21 am
by Bot_Builder
PNG
Posted: Sun May 15, 2005 3:26 am
by ViperGuy911
PNG is not a supported format.
Posted: Sun May 15, 2005 4:07 am
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.
Posted: Mon May 16, 2005 1:06 am
by Guest
did u ever get it to work?
Posted: Mon May 16, 2005 2:49 am
by ViperGuy911
No. Sorry, not yet. When I do i'll post it with the person who helped me.
Posted: Mon May 16, 2005 4:40 am
by ViperGuy911
K. Its done.
Thanks RabidLockerGnome