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.

Messages - andrew30

Pages: [1]
Graphics / Re: Failed to load image from memory. Reason: Out of memory
« on: August 14, 2021, 06:45:31 pm »
Thank you all for your help, I created texture atlases and now textures take up much less memory and the animation rendering performance has increased and everything works in 32-bit mode. The game is simple, so it doesn't make sense to load textures into memory on demand.

I noticed that while loading my game, initially 30% of the memory was taken up, after loading it became 90% busy, and the game process itself takes 60+ megabytes, and does not show a process that could take 60% of the memory

That is, I have to redo the textures and compact the images in one file?

I am using textures with a resolution of 1920 x 1080 in PNG format. But their weight is small, about 30 - 200 KB

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]