how exactly do you use it? let's benchmark it with Profiler
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Probably there's a room for optimization, I don't know how {transparentColor} options affect perfomance, if we can disable them totally.
P. S. WIth disabled texture filtering perfomance is the same.
local texturesArr={
Texture.new("1.jpg"), --no 'true' flag for filtering
Texture.new("2.jpg"),
Texture.new("3.jpg")}
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
It could be though that gpu drawing of pixel is faster than bitmap depending on how opengl draws it and how the list is arranged.
To profile 'drawing' you need to draw x amount and see when they go over a frame, the x count is the effective speed - the higher the better.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
It could be though that gpu drawing of pixel is faster than bitmap depending on how opengl draws it and how the list is arranged.
To profile 'drawing' you need to draw x amount and see when they go over a frame, the x count is the effective speed - the higher the better.
So question is not answered then. Can you pls provide quick example how to test it properly?
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Something like this (untested) might work for bitmaps...
localrandom=math.random-- number of bitmaps to change each iterationlocal count =500-- a texturepack containing 6 multicolored 64x64 tileslocal pack = TexturePack.new("tiles.txt", "tiles.png")-- some debug textlocal info = TextField.new(nil, '')
info:setTextColor(0xa0b0c0)
info:setScale(3)
info:setPosition(8, 24)-- somewhere to hang the bitmapslocal objects = Sprite.new()-- create a bunch of bitmapslocal bitmaps ={}for i =1, 10000dolocal bitmap = Bitmap.new(pack:getTextureRegion('t' .. random(1, 6) .. '.png'))
bitmap:setPosition(random(1, 320 - 64), random(1, 480 - 64))
bitmaps[#bitmaps + 1]= bitmap
end-- add 100 bitmaps to the next iterationlocalfunction onTouchBegin(e)
count +=100end-- retexture bitmapslocalfunction onEnterFrame(e)localrandom=math.random
objects:removeFromParent()
objects =nil
objects = Sprite.new()for i =1, count do
objects:addChild(bitmaps[i])end
objects:addChild(info)
stage:addChild(objects)local start =os.timer()for i =1, count dolocal bitmap = bitmaps[i]
bitmap:setTextureRegion(pack:getTextureRegion('t' .. random(1, 6) .. '.png'))endlocal elapsed =math.floor((os.timer() - start)*1000)
info:setText(count .. ' bitmaps in ' .. elapsed .. 'ms')end-- add listeners
stage:addEventListener(Event.TOUCHES_BEGIN, onTouchBegin)
stage:addEventListener(Event.ENTER_FRAME, onEnterFrame)
I guess you want to be aiming to see how many will draw in about 16ms which is one frame? I dunno but it's a starting point
Good idea, Thx! I've tested your code as it is, and with Pixel instead of bitmap:
--local bitmap = Bitmap.new(pack:getTextureRegion('t' .. random(1, 6) .. '.png')) --antix' original linelocal bitmap = Pixel.new(0xffffff,1,280,280)--make it pixel instead of bitmap
If I got it right, it seems that Bitmap without doubt perfoms better, maybe even more than 20%.
> Newcomers roadmap: from where to start learning Gideros "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Comments
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
I'm planning to replace the texture every five frames or so, to create a looping frame based animation.
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
P. S. WIth disabled texture filtering perfomance is the same.
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
To profile 'drawing' you need to draw x amount and see when they go over a frame, the x count is the effective speed - the higher the better.
https://deluxepixel.com
(sorry, I usually call all the pictures 'sprites', though term 'bitmap' should've been used in this case) So question is not answered then.
Can you pls provide quick example how to test it properly?
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Likes: Apollo14
I've tested your code as it is, and with Pixel instead of bitmap:
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)