Skip to main content
GameDev.net gamedev.net
🔒 Locked

transparency problem

Started by meeshoo Nov 18, 2004 at 10:55 AM 9 replies 4.1k views
Original Post
meeshoo
meeshoo
hi there. well, i have som problems with transparency. i make my textures in photoshop, and i save them as Windows bmp files with 32 bit / pixel, using the advanced setting A8R8G8B8(a bottom-up image) and building the texture as in alir's thread. for getting smooth transitions, i use some gradients in the alpha channel. the problem is the result is like i have 1 bit for alpha, but i have 8. there is transparency or it isn't, no smooth transitions. something like if the alpha channel value is above 0.5 there si transparency and if it is under is no transparency. that's odd. i use the combination GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA for the blend function. dont' know why is that happening, please help
MonkeyCookie
MonkeyCookie
As far as I know of, bitmaps do not support transparency. Gifs support binary transparency (color is transparent or it's not). PNG files, on the other hand, support 256 degrees of transparency, from completely opaque to completely transparent.
meeshoo
meeshoo
well, my bmp supported transparency like gif. but i will go on and use PNG. thanks for help
meeshoo
meeshoo
hey, i was using alir's tutorial to load my bitmaps. now, what do i use for png? cause the same code doesn't work.
rick_appleton
rick_appleton
You need to load them by hand. If you can wait until tomorrow or so, I'll send you my loader. I currently use TGA files since they are easy to load (see NeHe tutorial), but I plan on moving over to PNG to keep filesizes down.
meeshoo
meeshoo
oh, thanks. you don't need to send me your loader, i'll handle it on myown. i just wanted to know if there is any automation in this, but it doesn't. anyway, png is much more complicated to load than tga files, so you should think twice. i've just got the file format and there shouldnt be so big size difference, because for every pixel, the png stores a suplimentary byte containing the length of each chunck. so there isn't so much big thing about it.

i already had nehe tga loader implemented in one of my projects. do you use separate files loading, or u still use the bar file, and use the binary stream compiled in there? because you can improve your file size by putting them into bar files.

off topic: do you know when they will post some submitting info?
rick_appleton
rick_appleton
Well, I already have PNG loading in my general PC framework, so I plan on porting it from there.

As for where to put the data, I haven't looked into BAR files yet, but I plan on putting everything in one BAR file. However, I do have changing data (save games) and those will go in the folder outside the BAR file.

No idea when the submission guidelines will be posted. I won't need them for another week ;).

I wonder how many people are going to enter.

Good luck.
meeshoo
meeshoo
ok. thanks for info. i'm on the demo thread, so we don't compete with each other :-) .good luck and happy coding
Myopic Rhino
Myopic Rhino
This is a limitation with the implementation. Internally, we represent textures with 16 bits, in one of three formats: RGB565, RGBA5551, or RGBA4444. 32 bit textures by default are converted into RGBA5551. If you need more bits of alpha, I'd recommend converting the texture to 4444 yourself before passing it to glTexImage2D (and when you do, be sure to use GL_UNSIGNED_SHORT_4_4_4_4 for the type).

We'll have sumbission info posted in a couple of days. The thing that's holding us up is that we want to include some guidelines for documentation, and we just haven't had time to finish them. But the submission itself will be a simple FTP uploaded with an email to us so we know it's there.
meeshoo
meeshoo
ok, thanks alot for you info.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.