Good day. I made a 64-bit game, everything worked well, I connected all the libraries according to the instructions, then I decided to build the 32-bit version, I set everything up according to the instructions, I connected all the libraries, set the paths to the libraries, the build is successful, but when I run the debug 32x version after some
then after loading the game an error window appears and the console displays: “Failed to load image from memory. Reason: Out of memory ”. In the release version, some time after the download, the game simply crashes. In 64 versions everything works in both release and debug versions. Can anyone know what the problem might be?
First, I create textures on the heap, then load them from memory via a function:
Texture * LoadTextureFromResource (const unsigned short & ID, const char * type)
{
HRSRC rsrcData = FindResource (NULL, MAKEINTRESOURCE (ID), type);
if (! rsrcData)
throw std :: runtime_error ("Failed to find resource.");
DWORD rsrcDataSize = SizeofResource (NULL, rsrcData);
if (rsrcDataSize <= 0)
throw std::runtime_error("Size of resource is 0.");
HGLOBAL grsrcData = LoadResource(NULL, rsrcData);
if (!grsrcData)
throw std::runtime_error("Failed to load resource.");
LPVOID firstByte = LockResource(grsrcData);
if (!firstByte)
throw std::runtime_error("Failed to lock resource.");
Texture *texture = new Texture;
//LOGGER(rsrcDataSize)
// LOGGER(firstByte)
// LOGGER(texture != nullptr)
cout<<ID<<endl;
if (!texture->loadFromMemory(firstByte, rsrcDataSize))
throw std::runtime_error("Failed to load image from memory.");
//return nullptr;
//return Texture();
return texture;
}
In total I have about 684+ - textures