MCPcopy Create free account
hub / github.com/DentonW/DevIL / ILAPIENTRY ilGenImages

Function ILAPIENTRY ilGenImages

DevIL/src-IL/src/il_stack.cpp:48–82  ·  view source on GitHub ↗

Creates Num images and puts their index in Images - similar to glGenTextures().

Source from the content-addressed store, hash-verified

46
47//! Creates Num images and puts their index in Images - similar to glGenTextures().
48void ILAPIENTRY ilGenImages(ILsizei Num, ILuint *Images)
49{
50 ILsizei Index = 0;
51 iFree *TempFree = FreeNames;
52
53 if (Num < 1 || Images == NULL) {
54 ilSetError(IL_INVALID_VALUE);
55 return;
56 }
57
58 // No images have been generated yet, so create the image stack.
59 if (ImageStack == NULL)
60 if (!iEnlargeStack())
61 return;
62
63 do {
64 if (FreeNames != NULL) { // If any have been deleted, then reuse their image names.
65 TempFree = (iFree*)FreeNames->Next;
66 Images[Index] = FreeNames->Name;
67 ImageStack[FreeNames->Name] = ilNewImage(1, 1, 1, 1, 1);
68 ifree(FreeNames);
69 FreeNames = TempFree;
70 } else {
71 if (LastUsed >= StackSize)
72 if (!iEnlargeStack())
73 return;
74 Images[Index] = LastUsed;
75 // Must be all 1's instead of 0's, because some functions would divide by 0.
76 ImageStack[LastUsed] = ilNewImage(1, 1, 1, 1, 1);
77 LastUsed++;
78 }
79 } while (++Index < Num);
80
81 return;
82}
83
84ILuint ILAPIENTRY ilGenImage()
85{

Callers

nothing calls this directly

Calls 2

ilSetErrorFunction · 0.85
iEnlargeStackFunction · 0.85

Tested by

no test coverage detected