Creates Num images and puts their index in Images - similar to glGenTextures().
| 46 | |
| 47 | //! Creates Num images and puts their index in Images - similar to glGenTextures(). |
| 48 | void 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 | |
| 84 | ILuint ILAPIENTRY ilGenImage() |
| 85 | { |
nothing calls this directly
no test coverage detected