dtk_load_image man page

dtk_load_image — Load an image file as a texture


#include <drawtk.h>

dtk_htex dtk_load_image(const char *filename, unsigned int mxlvl);


This function load the image file specified by filename argument. It will creates the mipmaps until level mxlvl. Upon creation, the texture will then been tracked by an internal texture manager so that the next call using the same filename argument will return the same texture handle, thus sparing the resources of the system.

There is no need for a valid window to create successfully a texture, i.e. creation of textures are completely decoupled from the creation of others resources and can even be created in one thread to be used in another one.

Mipmaps are version of the same image at lower resolution (every power of two). Mipmap at level 0 is the original image. Given the size of the texture displayed in the framebuffer, the closest mipmaps are used to interpolate the value of displayed pixels. Do a research on internet for further details about mipmaps.

Return Value

In case of success, the function returns the handle to the created texture. In case of failure, NULL is returned.

Thread Safety

dtk_load_image() is thread-safe.

Referenced By

dtk_create_image(3), dtk_destroy_texture(3), dtk_texture_getsize(3).

Explore man page connections for dtk_load_image(3).

EPFL Draw Toolkit manual 2010