Post by hillridge on Mar 16, 2019 16:12:00 GMT -8
I'll preface this by saying that I am not using the GD2 Library, but have enjoyed using it and the examples as references.
I'm trying to pre-load a handful of images and assign them bitmap handles, but something seems to wipe out the handles. What situations typically clear them?
This is the code I use to load the image data into memory and set up the handles. it may look a bit odd since I'm not using the library:
Later, when I go to draw the image via the handle like this, it doesn't work:
However, if I set up the bitmap handle again just before those lines, it works perfectly:
Does a new DLStart command wipe out the existing bitmap handles? How can I load them once and always have them set?
Thanks!
I'm trying to pre-load a handful of images and assign them bitmap handles, but something seems to wipe out the handles. What situations typically clear them?
This is the code I use to load the image data into memory and set up the handles. it may look a bit odd since I'm not using the library:
for(int i=0;i<NUM_ASSETS;i++)
{
strcpy(path_buffer, ASSET_PATH);
strcat(path_buffer,asset[i].file_name);
Ft_Gpu_Hal_WrCmd32(&ui_host, BITMAP_HANDLE(i));
Ft_Gpu_Hal_WrCmd32(&ui_host, BITMAP_SOURCE(RAM_LOC));
Ft_Gpu_Hal_WrCmd32(&ui_host, BITMAP_LAYOUT(asset[i].gfx_format, asset[i].width*2,asset[i].height));
Ft_Gpu_Hal_WrCmd32(&ui_host, BITMAP_SIZE(NEAREST,BORDER,BORDER,asset[i].width,asset[i].height));
ui_load_graphic(path_buffer, &asset[i].loc, &RAM_LOC);
}
Later, when I go to draw the image via the handle like this, it doesn't work:
Ft_Gpu_Hal_WrCmd32(&ui_host, BEGIN(BITMAPS));
Ft_Gpu_Hal_WrCmd32(&ui_host, VERTEX2II(20,10,MY_HANDLE, 0));
However, if I set up the bitmap handle again just before those lines, it works perfectly:
Ft_Gpu_Hal_WrCmd32(&ui_host, BITMAP_HANDLE(MY_HANDLE));
Ft_Gpu_Hal_WrCmd32(&ui_host, BITMAP_SOURCE(asset[MY_HANDLE].loc));
Ft_Gpu_Hal_WrCmd32(&ui_host, BITMAP_LAYOUT(asset[MY_HANDLE].gfx_format, asset[MY_HANDLE].width*2,asset[MY_HANDLE].height));
Ft_Gpu_Hal_WrCmd32(&ui_host, BITMAP_SIZE(NEAREST,BORDER,BORDER,asset[MY_HANDLE].width,asset[MY_HANDLE].height));
Ft_Gpu_Hal_WrCmd32(&ui_host, BEGIN(BITMAPS));
Ft_Gpu_Hal_WrCmd32(&ui_host, VERTEX2II(20,10,MY_HANDLE, 0));
Does a new DLStart command wipe out the existing bitmap handles? How can I load them once and always have them set?
Thanks!