Is there a way to load textures from a file at runtime? I tried to modify the "neheGX" example number 6 to use TPL_OpenTPLFromFile instead of TPL_OpenTPLFromMemory, but simply switching the function calls and removing the nehe-related header files produced only a black screen and inert machine. (I put the file NeHe.bmp both in the same directory as the executable and in the root of the SD card; neither worked) How are you supposed to use the function TPL_OpenTPLFromFile? Loading at compile time would be fine too, but I don't understand how the image file is converted and the header files are produced in the example.
MODIFIED:
Code: Select all
GX_InvVtxCache();
GX_InvalidateTexAll();
TPL_OpenTPLFromFile(&neheTPL, "NeHe.bmp");
TPL_GetTexture(&neheTPL,0,&texture);
// setup our camera at the origin
// looking down the -z axis with y up
guLookAt(view, &cam, &up, &look);
ORIGINAL:
Code: Select all
GX_InvVtxCache();
GX_InvalidateTexAll();
TPL_OpenTPLFromMemory(&neheTPL, (void *)NeHe_tpl,NeHe_tpl_size);
TPL_GetTexture(&neheTPL,nehe,&texture);
// setup our camera at the origin
// looking down the -z axis with y up
guLookAt(view, &cam, &up, &look);