[fpc-pascal] Loading PNG files as OpenGL textures

Michael Van Canneyt michael at freepascal.org
Sun Oct 11 08:53:50 CEST 2015

On Sun, 11 Oct 2015, Ryan Joseph wrote:

> I’m coming from the Mac and I’d like to replace some code that loads .png files into OpenGL textures using Apple libraries that aren’t cross platform compatible.
> Does the FPC RTL contain any units for loading PNG files as bitmaps that I could extract the pixel data from and make textures for? I was using .png but I could use TIFF also or any other format which has an alpha channel.
> I’ve found Vampyre Imaging Library but a) it’s huge and does far more than I need and b) I haven’t been able to find all it’s various dependancies, some of which use a newer version of OpenGL I’m not using. A small simple solution would be best if that’s possible.

You can use the fpimage and fpreadpng units. 
Check the packages/fcl-image sources. 
There is a small demo program that shows how to do it.


More information about the fpc-pascal mailing list