ImageData is indeed just the decoded pixels stored in regular memory. Image (love.graphics) represents a non-changeable OpenGL texture stored in GPU memory. Sending a texture to the GPU is expensive. You don't want to do this every frame.
MaskedRetreiver wrote:Huh. In my case I'm using imageData so I can use the :paste method to slice up tile files into their own graphical contexts... perhaps there's something in graphics I'm missing?
--a 640x480 graphic is 20x15 tiles
for j=0,14 do
for i=0,19 do
tileImagepile[i+j*15]= love.image.newImageData(32,32)
tileImagepile[i+j*15]:paste(TilesImageData,0,0,32*i,32*j,32,32)
end
end
--a 640x480 graphics is 20x15 tiles
tiles = {}
tileImage = love.graphics.newImage("tiles.png")
local tw = tileImage:getWidth()
local th = tileImage:getHeight()
for j = 0, 14 do
for i = 1, 20 do -- to work with Lua's 1-indexed array system
tiles[i+j*20] = love.graphics.newQuad(32*(i-1),32*j,32,32,tw,th)
end
end
Is drawing quads any faster than drawing images, or just easier? I think to get performance I'll still have to break my game world up into big chunks and save them for rapid single-command display...
Yep, I benchmarked drawing a load of tiles against my current method and it's definitely faster. I'm still going to be drawing my screen in big chunks of tiles pasted together, but I'll probably switch to quads eventually for the speed boost. Thanks Love Forums!
(Seriously, this forum is amazingly friendly. Over at Allegro.cc you get keelhauled for even being a /little/ out of your depth.)
Oh, that was me. The big hole in the side of your house with the dead dolphin fetuses was bartbes. (You did that yesterday, didn't you, bartbes? Or were you going to do that tomorrow after all?)