Advertisement

Gifs

Started by January 10, 2004 11:45 AM
4 comments, last by Ructions 21 years, 1 month ago
i was wondering can you import gif file formats into opengl instead of bitmaps as you could use the transparency of the gifs
first of all, gifs cant be used without buying a license
2nd, it doesnt work that way
Advertisement
You can import anything into OpenGL as long as you write a loader for it. However if you load a gif and you'd want to use the transparancy of it, you'd have to load an alpha value of 0.0 into pixels which are tranaparent and 1.0 into ones that aren't. Then use alpha testing so the 0.0 alpha pixels don't get displayed. There's a tut on alpha testing on NeHe. As for loading the gif file learn about File I/O (if you haven't already) then go find the file format specification Wotsit may have it.

[edit]And as the above poster has said there's legal issues with GIFs. So if you planning to distribute your program it's best to avoid them[/edit]

[edited by - Monder on January 10, 2004 1:54:01 PM]
The patent has been expired in most countries (including the US) for quite some time now. And I think nehe''s ipicture code loads GIF''s with transparency.

-~-The Cow of Darkness-~-
You might want to look into png images. They have transparency, but unlike gifs, there is an actual alpha channel (ie it's not just transparent or opaque, it can be 33% opaque or whatever). It also allows you to use more colors (gif only allows 256). Read this summary of the differences if you are interested.

[edited by - Mr Grinch on January 10, 2004 3:02:09 PM]
i read in a newsletter last year that the patent was renewed. maybe im wrong but you should check it somewhere. btw the patent applies on commercial use.
"Knowledge is no more expensive than ignorance, and at least as satisfying." -Barrin

This topic is closed to new replies.

Advertisement