Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - andrew30

Pages: [1]
Graphics / Failed to load image from memory. Reason: Out of memory
« on: July 26, 2021, 02:06:22 pm »
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(firstByte)
   //   LOGGER(texture != nullptr)
   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

Pages: [1]