Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Ructions

IPicture ( Tranparency with Gif Files)

This topic is 5243 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i am using the Ipicture code from the nehe. but this code only makes black tranparent. i am using gif and want to make the tranparent areas in the gif transparent on the screen but they show up as white on the screen at the moment. // Convert From BGR To RGB Format And Add An Alpha Value Of 255 for(long i = 0; i < lWidthPixels * lHeightPixels; i++) // Loop Through All Of The Pixels { BYTE* pPixel = (BYTE*)(&pBits); BYTE temp = pPixel[0]; pPixel[0] = pPixel[2]; pPixel[2] = temp; if ((pPixel[0]==0) && (pPixel[1]==0) && (pPixel[2]==0)) pPixel[3] = 0; else pPixel[3] = 255; i have this in the initGL function glAlphaFunc(GL_GREATER,0.1f); glEnable(GL_ALPHA_TEST); i was wondering how do i set it up so that the transparency to be transparent and not the black be transparent. Hopefully this makes sence. i am a newbie to opengl [edited by - Ructions on January 14, 2004 1:08:58 PM] [edited by - Ructions on January 14, 2004 1:09:49 PM]

Share this post


Link to post
Share on other sites
Advertisement
The problem (maybe not) with the Ipicture code is that it return raw pixels of the image, i mean it doesnt care about the format, it always return the same type of data (lots of pixels, no compresion,transparency,etc).

you can work around this problem by working your sprites with a standard transparent color (ex:RGB(255,0,255)=bright pink no, body likes that color anyway) or set another argument to the function maybe DWORD colorKey?, then modify nehe code so it checks for your colorkey instead of RGB(0,0,0)=black.

but if you are really motivated you can google some information on the gif fileformat and maybe find some code that load gifs... then modify that code and then... you get the idea.

Share this post


Link to post
Share on other sites
I believe the way gif files do transparency is that they have a color flagged as the transparent color. I havent really worked with ipicture before but maybe there may be a way to get this info through ipicture.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!