[fpc-pascal] Loading PNG files as OpenGL textures

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Oct 15 11:38:14 CEST 2015


On Thu, 15 Oct 2015 15:30:41 +0700
Ryan Joseph <ryan at thealchemistguild.com> wrote:

> 
> > On Oct 14, 2015, at 1:49 PM, Michael Van Canneyt <michael at freepascal.org> wrote:
> > 
> > Type
> > TMyImage = Class(TFPCompactImgRGBA8Bit)
> > Public
> >  property Data :  PFPCompactImgRGBA8BitValue read FData;
> > end;
> > 
> > 
> > Should do it. Or if you don't need Alpha:
> > 
> > TMyImage = Class(TFPCompactImgRGB8Bit)
> > Public
> >  property Data :  PFPCompactImgRGB8BitValue read FData;
> > end;
> > 
> > You could throw in a property to get a direct pointer
> 
> TFPCompactImgRGBA8Bit descends from TFPMemoryImage I assume?

Actually it works like TFPMemoryImage and descends from
TFPCustomImage. The only difference is that it uses 4*8=32bit per pixel
instead of 4*16bit.

It is only a few lines of code, so if you need a different pixel format
or scan lines it is really easy to create your own image class.

> I need to draw text as textures also and I found an example at
> http://wiki.freepascal.org/fcl-image#Drawing_text which uses
> TFPMemoryImage.


Mattias



More information about the fpc-pascal mailing list