I have been trying to embed a png (with no luck) into my CS project. This is required and not an option on my part for portability. There will be only two images that are needed to be embedded - additional images will be loaded as local files.
I am on a recent install of CS/CEL 2.0 beta-1 compiled from source on 64bit Linux. Other than HawkNL, it compiled fine.
I have tried using ImageMagick's command 'convert' to get a header file (convert foo.png -o foo.h). I have tried using that header in my project but it produces a very large executable and i couldn't get fmemopen (stdio.h) to do anything with it (lack of knowledge on my part, i know).
So i tried using 'bin2c' and that also produces a static array but in a vector format which is needed for png's (bin2c foo.png foo.cpp). It produces a much smaller file than ImageMagick and it gets complied into the project fine.
Example of Output....
static char foo_png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x07, 0xd0, 0x00, 0x00, 0x03, 0x4f,
My question is, how do use that as a texture? I know how to use a file locally but I can't find any clear examples of how to get a stream or use fmemopen to get a FILE * pointer and use that as a texture.
If anyone has an example of could point me in the right direction that would be great.
Thanks, Phorem.