png files with transparency in openGL?

pixpooch
Unregistered
 
Post: #1
Can you use png files with transparency in openGL or do you need to use a masking technique and bitmaps, like the masking example on NEHE?

Just wondering, if you can are there any tutorials or examples?

thanks,
pixpooch
Huh
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
Yes, you can use PNG files with alpha in OpenGL.

You'll need to combine blending (I think NeHe has a tutorial) with some code to actually load the PNG (For example, as in QTValuePak on this site).
Quote this message in a reply
Member
Posts: 79
Joined: 2002.08
Post: #3
I couldn't get png with an alpha channel to work right but I used the glpng library at the time also so maybe that was part of the problem. But it seemed like PhotoShop didn't save the alpha channel in png's. But I didn't look into it too much since it worked fine when I switched to tiff's.

KenD
Quote this message in a reply
Member
Posts: 110
Joined: 2002.04
Post: #4
Quote:Originally posted by pixpooch
Can you use png files with transparency in openGL or do you need to use a masking technique and bitmaps, like the masking example on NEHE?
Huh


Yes...
You need to down load glpng
do a search in google are you should fined it.
What it does is load PNGs properly into GL textures for you...
loads the alphas and all sorts of other options also.

PhotoShop does save the alpha channels in PNGs though they keep changing ps so it may take some playing with to get it working depending on what version of ps you use.
But it DOES WORK.

- Mac Lead ZeniMax Online Studios
- Owner Plaid World Studios
- Resume: http://www.chrisdillman.com
Quote this message in a reply
pixpooch
Unregistered
 
Post: #5
Thanks everyone, that helps a lot.
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #6
Quote:Originally posted by ChrisD
PhotoShop does save the alpha channels in PNGs though they keep changing ps so it may take some playing with to get it working depending on what version of ps you use.
But it DOES WORK.
Get the (free) SuperPNG plugin for Photoshop: http://www.fnordware.com/superpng/

It will save you *many* a headache (PS7's PNG-w/alpha support is broken as far as I can tell).
Quote this message in a reply
Member
Posts: 110
Joined: 2002.04
Post: #7
Quote:Originally posted by Frank C.
Get the (free) SuperPNG plugin for Photoshop: http://www.fnordware.com/superpng/

It will save you *many* a headache (PS7's PNG-w/alpha support is broken as far as I can tell).


No Alpha is not broken in PS7
Your just doing it wrong...

How are you making your alpha channel?

- Mac Lead ZeniMax Online Studios
- Owner Plaid World Studios
- Resume: http://www.chrisdillman.com
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #8
Quote:Originally posted by ChrisD
No Alpha is not broken in PS7
Your just doing it wrong...
I should have said: "broken as far as I'm concerned"...

I prefer "old school" alpha channels (which PS7 doesn't allow when saving PNG). The "transparent layer" approach is destructive if you're using the same image with multiple (and different) alpha maps. There are ways around it like multiple copies, or multi-layered working files, but I prefer the old methods (got old dog new trick syndrome).

Silly thing is, Adobe released a new TGA plugin that restores the "old" style alpha channels (after many complaints) but failed to do the same for PNG - unless I missed it.

SuperPNG gives you more options than PS's built-in PNG regardless.
Quote this message in a reply
Member
Posts: 110
Joined: 2002.04
Post: #9
Quote:Originally posted by Frank C.
I should have said: "broken as far as I'm concerned"...

I prefer "old school" alpha channels (which PS7 doesn't allow when saving PNG). The "transparent layer" approach is destructive if you're using the same image with multiple (and different) alpha maps. There are ways around it like multiple copies, or multi-layered working files, but I prefer the old methods (got old dog new trick syndrome).


BLAH... I don't like the new method either...
At first I thought it was broke also...

Quote: Silly thing is, Adobe released a new TGA plugin that restores the "old" style alpha channels (after many complaints) but failed to do the same for PNG - unless I missed it.

SuperPNG gives you more options than PS's built-in PNG regardless.


How does the plug in work?
I mean can you know make a plug in that changes how layers work?
or is it only at save time that anything takes effect?

- Mac Lead ZeniMax Online Studios
- Owner Plaid World Studios
- Resume: http://www.chrisdillman.com
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #10
Quote:Originally posted by ChrisD
How does the plug in work?
I mean can you know make a plug in that changes how layers work? or is it only at save time that anything takes effect?
It's just a file format plugin that shows up as "SuperPNG" in Save/Open dialogs in the list of supported formats.

You can actually keep the original PS PNG plugin installed and use them side-by-side, but PS will default to it's own PNG format if you double click or drag & drop a PNG file to open it (and mangle the alpha channel into a layer transparency).
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Sprite transparency in OpenGL? Guest! 26 29,948 Feb 17, 2012 09:24 AM
Last Post: Skorche
  OpenAL - Ogg files vs Caf files Fred9000 8 14,310 Aug 23, 2011 08:01 PM
Last Post: ipeku
  OpenGL ES 2.0, 2D Alpha Transparency Artifacts Macmenace 3 8,009 Mar 28, 2010 11:18 PM
Last Post: AnotherJake
  libpng transparency problem wyrmmage 3 5,387 Mar 1, 2007 05:53 PM
Last Post: OneSadCookie
  Strange transparency errors... thingythekid 4 4,200 Aug 24, 2005 05:01 AM
Last Post: thingythekid