S sorex Expert Licensed User Longtime User Jun 23, 2018 #1 Regarding the posted slowdown... Star-Dust said: This was extremely slow Click to expand... The culprit seems to be drawpath that updates the canvas/image at every usage. @Erel, can you confirm (by looking at your sources) that drawpath auto invalidates? is this a feature or a bug?
Regarding the posted slowdown... Star-Dust said: This was extremely slow Click to expand... The culprit seems to be drawpath that updates the canvas/image at every usage. @Erel, can you confirm (by looking at your sources) that drawpath auto invalidates? is this a feature or a bug?
Star-Dust Expert Licensed User Longtime User Jun 23, 2018 #2 sorex said: Regarding the posted slowdown... The culprit seems to be drawpath that updates the canvas/image at every usage. @Erel, can you confirm (by looking at your sources) that drawpath auto invalidates? is this a feature or a bug? Click to expand... Anyway BitmapCreator on B4J is much faster then Canvas, the procedures of DrawPath that I put in code snippet (here) ere very fast. I'll probably make a version of my B4J library that only uses BitmapCreator, if I have time Upvote 0
sorex said: Regarding the posted slowdown... The culprit seems to be drawpath that updates the canvas/image at every usage. @Erel, can you confirm (by looking at your sources) that drawpath auto invalidates? is this a feature or a bug? Click to expand... Anyway BitmapCreator on B4J is much faster then Canvas, the procedures of DrawPath that I put in code snippet (here) ere very fast. I'll probably make a version of my B4J library that only uses BitmapCreator, if I have time
S sorex Expert Licensed User Longtime User Jun 23, 2018 #3 I used your snippet for testing and it was dreadfull slow due to the invalidate. you don't notice it on your rubiks cube but you will when drawing a few hundreds of polygons. I don't think there's a real bitmapcreator fillpath or I looked over it. Upvote 0
I used your snippet for testing and it was dreadfull slow due to the invalidate. you don't notice it on your rubiks cube but you will when drawing a few hundreds of polygons. I don't think there's a real bitmapcreator fillpath or I looked over it.
Star-Dust Expert Licensed User Longtime User Jun 23, 2018 #4 Invalidate needed only in b4jh, while release It is only necessary in b4i. It is explained in the documentation of the Xui library Upvote 0
Invalidate needed only in b4jh, while release It is only necessary in b4i. It is explained in the documentation of the Xui library
S sorex Expert Licensed User Longtime User Jun 23, 2018 #5 well, that's the point of the problem. it's invalidating on each drawpath that's what causing the slow down. it should be done once and 'manually' after all polys have been drawn. Upvote 0
well, that's the point of the problem. it's invalidating on each drawpath that's what causing the slow down. it should be done once and 'manually' after all polys have been drawn.
Star-Dust Expert Licensed User Longtime User Jun 23, 2018 #6 I did it at the end of rendering after drawing all the polygons Upvote 0
S sorex Expert Licensed User Longtime User Jun 23, 2018 #7 I wrote a few times already that it is done automatically when using drawpath so you just did an extra invalidate. here's an example that it does update the red line without the invalidate Code: Copy Dim p As Pane p.Initialize("") MainForm.RootPane.AddNode(p,0,0,640,400) Dim can As B4XCanvas can.Initialize(p) Dim pp As B4XPath pp.Initialize(0,0) pp.LineTo(100,100) pp.LineTo(0,100) can.DrawPath(pp,0xffff0000,False,1) ' can.Invalidate Upvote 0
I wrote a few times already that it is done automatically when using drawpath so you just did an extra invalidate. here's an example that it does update the red line without the invalidate Code: Copy Dim p As Pane p.Initialize("") MainForm.RootPane.AddNode(p,0,0,640,400) Dim can As B4XCanvas can.Initialize(p) Dim pp As B4XPath pp.Initialize(0,0) pp.LineTo(100,100) pp.LineTo(0,100) can.DrawPath(pp,0xffff0000,False,1) ' can.Invalidate
Erel B4X founder Staff member Licensed User Longtime User Jun 24, 2018 #8 It is not related to DrawPath. JavaFX Canvas object "auto invalidates". There is no invalidate method in jFX. B4XCanvas.Invalidate doesn't do anything in B4J. Upvote 0
It is not related to DrawPath. JavaFX Canvas object "auto invalidates". There is no invalidate method in jFX. B4XCanvas.Invalidate doesn't do anything in B4J.
S sorex Expert Licensed User Longtime User Jun 24, 2018 #9 ok, that's a shame then. my initial 3D model drawing example used the extended canvas lib (from Klaus?) .drawPolygon and it's way faster and there's no need to invalidate either. I think it's 60fps vs 0.5fps so the difference is huge. Upvote 0
ok, that's a shame then. my initial 3D model drawing example used the extended canvas lib (from Klaus?) .drawPolygon and it's way faster and there's no need to invalidate either. I think it's 60fps vs 0.5fps so the difference is huge.
Star-Dust Expert Licensed User Longtime User Jun 24, 2018 #10 Klaus uses the native android library, I use XUI. I'll try a test using the native library Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jun 24, 2018 #11 It has nothing to do with invalidation. It is possible that DrawPath is slow as it requires clipping the canvas. DrawPolygon is not the same as DrawPath. B4XCanvas and Canvas have the exact same performance characteristics. Upvote 0
It has nothing to do with invalidation. It is possible that DrawPath is slow as it requires clipping the canvas. DrawPolygon is not the same as DrawPath. B4XCanvas and Canvas have the exact same performance characteristics.
S sorex Expert Licensed User Longtime User Jun 24, 2018 #12 ok, that makes sense. I did tests before with clipping due to the lack of some function and indeed it's slow as hell. drawPolygon exists in java fx but it's not exposed in B4J (yet) Upvote 0
ok, that makes sense. I did tests before with clipping due to the lack of some function and indeed it's slow as hell. drawPolygon exists in java fx but it's not exposed in B4J (yet)
Erel B4X founder Staff member Licensed User Longtime User Jun 24, 2018 #13 You can call it with JavaObject. Start a new thread if you like to do it. Upvote 0