1DTK_LOAD_IMAGE(3) Draw Toolkit manual DTK_LOAD_IMAGE(3)
2
3
4
6 dtk_load_image - Load an image file as a texture
7
9 #include <drawtk.h>
10
11 dtk_htex dtk_load_image(const char *filename, unsigned int mxlvl);
12
14 This function load the image file specified by filename argument. It
15 will creates the mipmaps until level mxlvl. Upon creation, the texture
16 will then been tracked by an internal texture manager so that the next
17 call using the same filename argument will return the same texture han‐
18 dle, thus sparing the resources of the system.
19
20 There is no need for a valid window to create successfully a texture,
21 i.e. creation of textures are completely decoupled from the creation
22 of others resources and can even be created in one thread to be used in
23 another one.
24
25 Mipmaps are version of the same image at lower resolution (every power
26 of two). Mipmap at level 0 is the original image. Given the size of the
27 texture displayed in the framebuffer, the closest mipmaps are used to
28 interpolate the value of displayed pixels. Do a research on internet
29 for further details about mipmaps.
30
32 In case of success, the function returns the handle to the created tex‐
33 ture. In case of failure, NULL is returned.
34
36 dtk_load_image() is thread-safe.
37
39
40
41
42
43
44EPFL 2010 DTK_LOAD_IMAGE(3)