[fpc-pascal] Loading PNG files as OpenGL textures
    Michael Van Canneyt 
    michael at freepascal.org
       
    Mon Oct 12 09:25:28 CEST 2015
    
    
  
On Sun, 11 Oct 2015, Ryan Joseph wrote:
>
>> On Oct 11, 2015, at 1:53 PM, Michael Van Canneyt <michael at freepascal.org> wrote:
>> 
>> 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.
>
> I see you can load an image as TFPCustomImage with TFPCustomImageReader then there is a canvas class (TFPCustomCanvas) which I assume I could draw the TFPCustomImage into and expose the pixels as a pointer to memory which I could then use to make the OpenGL texture.
You don't need TFPCustomCanvas.
TFPCustomImage is an abstract image class, it provides no storage for the data. 
It can have several descendants such as TFPMemoryImage and TFPCompactImgRGBA8Bit.
If you just want the raw data, create a TFPMemoryImage and access the Colors array property.
Michael.
    
    
More information about the fpc-pascal
mailing list