What is Image object? First topic.

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
ErtYwek
Prole
Posts: 6
Joined: Sat Nov 03, 2018 3:59 pm
Contact:

What is Image object? First topic.

Post 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.
User avatar
pgimeno
Party member
Posts: 3550
Joined: Sun Oct 18, 2015 2:58 pm

Re: What is Image object? First topic.

Post 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.
User avatar
ErtYwek
Prole
Posts: 6
Joined: Sat Nov 03, 2018 3:59 pm
Contact:

Re: What is Image object? First topic.

Post 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?
User avatar
pgimeno
Party member
Posts: 3550
Joined: Sun Oct 18, 2015 2:58 pm

Re: What is Image object? First topic.

Post 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?
User avatar
ErtYwek
Prole
Posts: 6
Joined: Sat Nov 03, 2018 3:59 pm
Contact:

Re: What is Image object? First topic.

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 209 guests