This is a project that our university is asking us to go through (asking for help on third places is not restricted) We have to build a 3D scene in which objects are mapped with textures.
I'm stuck where I need to load a BMP file's data into the program. We have to use a library that is already present in the system (forbidden to code it).
My request is : Using fedora (gnome environment), is there a pre-built library into which a function that loads BMP files and returns a pointer to the payload is existent ?
EDIT : We are forbidden to install any additional libs, the lib must be a pre-built lib of Fedora.
Take a look at the GDK library and the funcion gdk_pixbuf_new_from_file. As you can see in the API you can use:
GdkPixbuf *bmp_pixbuf;
GError *error = NULL;
bmp_pixbuf = gdk_pixbuf_new_from_file ("/tmp/myfile.bmp", &error);
if (bmp_pixbuf == NULL) {
/* Error codes are GDK_PIXBUF_ERROR and G_FILE_ERROR */
}
It's important to check first the BMP support in GDK using:
$ gdk-pixbuf-query-loaders-64 | grep bmp
You need a library like libpixbufloader-bmp.so.
I don't know what library are you using to create the 3D scene, but you can get the raw pixels after load the pixbuf with gdk_pixbuf_get_pixels and then load into a surface.
Hope this help.