I've found a bug while working with RTT
local rt1 = RenderTarget.new(1024, 768, true)
local texture1 = Texture.new("logo.png")
local bitmap1 = Bitmap.new(texture1)
bitmap1:setPosition(0, 0)
rt1:draw(bitmap1)
local b_rt1 = Bitmap.new(rt1)
stage:addChild(b_rt1)
local rt2 = RenderTarget.new(1024, 768, true)
local texture2 = Texture.new("icon.png")
local bitmap2 = Bitmap.new(texture2)
bitmap2:setPosition(bitmap1:getWidth(), 0)
rt2:draw(bitmap2)
local b_rt2 = Bitmap.new(rt2)
stage:addChild(b_rt2) |
It looks ok, and result is att1
But, if I replace local bitmap2 = Bitmap.new(texture2) by local bitmap2 = Bitmap.new(texture1) (That mean I DO NOT USE texture2 anymore), icon image still be displayed and scaled. (att2)
local rt1 = RenderTarget.new(1024, 768, true)
local texture1 = Texture.new("logo.png")
local bitmap1 = Bitmap.new(texture1)
bitmap1:setPosition(0, 0)
rt1:draw(bitmap1)
local b_rt1 = Bitmap.new(rt1)
stage:addChild(b_rt1)
local rt2 = RenderTarget.new(1024, 768, true)
local texture2 = Texture.new("icon.png")
local bitmap2 = Bitmap.new(texture1)
bitmap2:setPosition(bitmap1:getWidth(), 0)
rt2:draw(bitmap2)
local b_rt2 = Bitmap.new(rt2)
stage:addChild(b_rt2) |
After that, I remove local texture2 = Texture.new("icon.png"):
local rt1 = RenderTarget.new(1024, 768, true)
local texture1 = Texture.new("logo.png")
local bitmap1 = Bitmap.new(texture1)
bitmap1:setPosition(0, 0)
rt1:draw(bitmap1)
local b_rt1 = Bitmap.new(rt1)
stage:addChild(b_rt1)
local rt2 = RenderTarget.new(1024, 768, true)
--local texture2 = Texture.new("icon.png")
--local bitmap2 = Bitmap.new(texture2)
local bitmap2 = Bitmap.new(texture1)
bitmap2:setPosition(bitmap1:getWidth(), 0)
rt2:draw(bitmap2)
local b_rt2 = Bitmap.new(rt2)
stage:addChild(b_rt2) |
Logo is displayed only one times. Nothing inside rt2 (att3)
It seems that bug will happen if we create/load a texture after calling RenderTarget:draw(). So, we should load & create texture before rendering. The following code works well:
local texture1 = Texture.new("logo.png")
local texture2 = Texture.new("icon.png")
local rt1 = RenderTarget.new(1024, 768, true)
local rt2 = RenderTarget.new(1024, 768, true)
local bitmap1 = Bitmap.new(texture1)
bitmap1:setPosition(0, 0)
rt1:draw(bitmap1)
local b_rt1 = Bitmap.new(rt1)
stage:addChild(b_rt1)
local bitmap2 = Bitmap.new(texture1)
bitmap2:setPosition(bitmap1:getWidth(), 0)
rt2:draw(bitmap2)
local b_rt2 = Bitmap.new(rt2)
stage:addChild(b_rt2) |
However, It's impossible in real game
Comments
Likes: SinisterSoft
https://deluxepixel.com
Likes: SinisterSoft
edit: now i may have found what my problem was and it was probably an error in my code, not in gideros, but i'm too tired to test now. in any case the bugfix release would be reassuring.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
we have a list of bugs to fix, including Kindle Fire HD specific bug, for which we ordered a device and it should arrive next week, after that we can fix it and release a bug fix version
Likes: SinisterSoft
Likes: SinisterSoft
Fragmenter - animated loop machine and IKONOMIKON - the memory game
https://deluxepixel.com
Likes: SinisterSoft, keszegh
if we could clear triangles that would be cool. even it could be as general as instead of drawing something you could 'erase' something and so it would set at each pixel of the rendertarget the alpha to max(alpha before erase call, alpha of the mesh to be erased).
this could work with erasing a mesh or shape or even any sprite.
that would be basically equivalent to masking.
of course erasing any triangle would be already quite nice.
Fragmenter - animated loop machine and IKONOMIKON - the memory game