Page 1 of 1
What is Image object? First topic.
Posted: Fri Apr 24, 2020 6:32 pm
by ErtYwek
Hey Ho! This is my first topic there on the LOVE2D forum and I hope it did not break any rule.
Question as in title. I don't understand why
Code: Select all
local sws4 = string.format("images: %.2f ", love.graphics.getStats().images)
return me
13.00 cause i use only one image which disappear very fast.
Re: What is Image object? First topic.
Posted: Fri Apr 24, 2020 9:19 pm
by pgimeno
Welcome to the forums!
Hard to tell without seeing your code, but Löve uses images for some internal things like fonts. For example, if main.lua just contains this:
Code: Select all
function love.draw()
love.window.setTitle(love.graphics.getStats().images)
end
the title displays 0, but if it contains this:
Code: Select all
function love.draw()
love.graphics.print('')
love.window.setTitle(love.graphics.getStats().images)
end
then the title displays 1.
To answer your question, an Image object is an OpenGL texture with fixed contents. It resides in the GPU memory and Löve contains a reference to it, in order to use it when you ask for it to be drawn. I believe that the CPU side does not hold the pixels.
Re: What is Image object? First topic.
Posted: Sun Apr 26, 2020 8:45 pm
by ErtYwek
Hi! Thank you for your reply. But I'm not sure what it means. So I have 1 image and 7 texts in total. Still away from 13. Did rectangle counts as opengl image?
Re: What is Image object? First topic.
Posted: Mon Apr 27, 2020 6:49 am
by pgimeno
I don't know; from a quick test it doesn't seem to count. Löve may be using internal textures for other things, like mipmaps. Why are you bothered about it?
Re: What is Image object? First topic.
Posted: Wed May 27, 2020 12:26 pm
by ErtYwek
pgimeno wrote: ↑Mon Apr 27, 2020 6:49 am
I don't know; from a quick test it doesn't seem to count. Löve may be using internal textures for other things, like mipmaps. Why are you bothered about it?
I think about optimization.