[fpc-pascal] Loading PNG files as OpenGL textures

Ryan Joseph ryan at thealchemistguild.com
Wed Oct 14 03:47:58 CEST 2015


> On Oct 12, 2015, at 8:39 PM, Reimar Grabowski <reimgrab at web.de> wrote:
> 
> http://sourceforge.net/p/asmoday/code/HEAD/tree/trunk/asmtypes.pas#l203
> 
> Not an example but a straightforward texture class implementation based on TFPCustomImage. Should work as is for bmp, jpg, png, tga, xpm, if not drop me a line.

Thanks, this is really helpful.

I see how you populated TFPCustomImage and generated “Data” to store the color values.

Is it necessary to build an entire subclass or can I just use TFPMemoryImage to achieve the same effect? I understand now TFPCustomImage is an abstract class but TFPMemoryImage apparently has stored values so I should be able to access the “Data” property but these seem to be accessors to getting single pixel values so I can’t just pass the entire block into glTexImage2D like you did.

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list