Loading images into the memory (quick question)

Discussion and feedback on Construct 2

Post » Thu Apr 02, 2015 5:40 pm

I know that the images get loaded into the memory when they're displayed, but there's one part I'm not sure about:

When I use a high resolution sprite (for ex.: 2048x2048 px) and it get's displayed on a small screen (let's say for ex. on a 640x480 resolution) how much memory will it take up? Will it take up memory based on the source file (which is a high resolution image) or based on the downscaled image shown on screen?
B
125
S
33
G
17
Posts: 1,516
Reputation: 20,329

Post » Thu Apr 02, 2015 6:44 pm

The source images from your project are loaded into memory at start up.
Who dares wins
B
56
S
16
G
21
Posts: 1,875
Reputation: 19,406

Post » Thu Apr 02, 2015 6:58 pm

lennaert wrote:The source images from your project are loaded into memory at start up.


Thank you. And what about the GPU memory? If I remember right, the images are all loaded there as bitmaps. In that case the source files load in with their full size?
B
125
S
33
G
17
Posts: 1,516
Reputation: 20,329

Post » Thu Apr 02, 2015 7:07 pm

Ashley wrote:The images go in to RAM and also in to VRAM (graphics card memory) if the rendering is hardware accelerated, which it usually is these days.

They get decompressed to the same size as the image saved as a 32-bit bitmap, so yes, a 1000x1000 pixel image will always take about 4mb of memory alone. This isn't much when both your computer and graphics card have gigabytes of memory, but bear in mind 4mb is still a lot for a single image on mobile.

The various compressed formats just package the data in to a smaller filesize. Compressed images cannot be drawn though, so it's normal to decompress the images in to memory whenever they are loaded.

We have plans for a feature to load textures layout by layout (like Classic can) somewhere on the todo list, to save memory with very large projects.
Who dares wins
B
56
S
16
G
21
Posts: 1,875
Reputation: 19,406

Post » Thu Apr 02, 2015 7:13 pm

lennaert wrote:
Ashley wrote:The images go in to RAM and also in to VRAM (graphics card memory) if the rendering is hardware accelerated, which it usually is these days.

They get decompressed to the same size as the image saved as a 32-bit bitmap, so yes, a 1000x1000 pixel image will always take about 4mb of memory alone. This isn't much when both your computer and graphics card have gigabytes of memory, but bear in mind 4mb is still a lot for a single image on mobile.

The various compressed formats just package the data in to a smaller filesize. Compressed images cannot be drawn though, so it's normal to decompress the images in to memory whenever they are loaded.

We have plans for a feature to load textures layout by layout (like Classic can) somewhere on the todo list, to save memory with very large projects.


And thank you again. Now it's cleared for me.
B
125
S
33
G
17
Posts: 1,516
Reputation: 20,329

Post » Sat Apr 04, 2015 12:35 pm

@lennaert - must be an old quote - it's basically accurate except we've supported layout-by-layout texture loading for a long time now!
Scirra Founder
B
383
S
224
G
86
Posts: 24,117
Reputation: 190,442

Post » Sat Apr 04, 2015 3:15 pm

Ashley wrote:lennaert - must be an old quote - it's basically accurate except we've supported layout-by-layout texture loading for a long time now!



Heh, yeah I had noticed, somehow searching for memory related information on the forum brought up the old qoute, I had read it before and referenced it a few times :? Should have searched the manual :All good now though
Who dares wins
B
56
S
16
G
21
Posts: 1,875
Reputation: 19,406


Return to Construct 2 General

Who is online

Users browsing this forum: repkino and 7 guests