> On Oct 12, 2015, at 3:46 AM, Anthony Walter <sys...@gmail.com> wrote:
> 
> You can write an interface to the quartz libs and have them load or save a 
> variety of image formats such as bmp, jpg, gif, and png. I've done this with 
> OpenGL on OSX with Free Pascal and I look for the code and post it to git 
> sometime, maybe even Today.
> 

This is what I do on Mac but I wanted to make some cross platform code so I 
need to kill lots of this Apple stuff.

Basically I loaded the image from file, made a CGImage wrapper to it (which 
understands PNG) and then draw it into a CGContext (like a bitmap canvas) then 
extracted the pixel data from the bitmap for use with glTexImage2D.

The FPC RTL on http://wiki.freepascal.org/fcl-image seems to do this but I 
don’t see the interface for TFPCustomCanvas so I don’t know if it’s possible to 
access the pixel data. 

There’s code at 
http://www.sulaco.co.za/opengl_project_BMP_JPG_TGA_texture_loader.htm which 
follows a similar procedure but it’s Delphi and I couldn’t get it to run on FPC 
on my anyways.


Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to