Jump to content

Problems reading an updated image from disk and putting it on screen


photo

Recommended Posts

I am getting an error message when I use an image on a WidgetSprite attached to an ObjectGui GUI. The warnings printed are;
 

Exception thrown at 0x00007FFE0208A388 in foobar_x64d.exe: Microsoft C++ exception: _com_error at memory location 0x00000060D22FEA68.
Direct3D11 error: invalid arg
D3D11Texture::create(): can't create RGBA8 1280x720 2D texture

The error occurs on the line "ws->setImage(image, 1)"

 

    image->load(imagename.c_str());
    Log::message("Loading image [%s]\n", imagename.c_str());
    if (image->isLoaded()) {
        image->createMipmaps();
        ws->setImage(image, 1);
    }

The error message does not appear when the "is dynamic" parameter on widgetSprite->setImage(Filename, Is dynamic) is changed to zero. However the image IS dynamic and if I set that parameter to zero then the updated image is never read from disk and (I think) the image is served up not from the file I specify but from an internal Unigine cache.

I have tried with both DDS files and PNG files. 

 

Edit: Actually solved by this: 

 

FileSystemAssets::get()->removeRuntime(imagename.c_str());

 

That bypasses the cache and I can load the changed image.

Edited by angus
Link to comment
×
×
  • Create New...