mawi1512 Posted January 31, 2019 Share Posted January 31, 2019 Hi all, I would like to know what's the most performant way to draw rectangles with borders. In my project I have to draw many such rectangles and they will change their width very often through different user actions. Actually I'm using NineSlicePlane, but maybe there is a other solutions with even better performance... Thank you! Quote Link to comment Share on other sites More sharing options...
bubamara Posted January 31, 2019 Share Posted January 31, 2019 sprite with another slightly smaller sprite as it's child Quote Link to comment Share on other sites More sharing options...
xerver Posted February 1, 2019 Share Posted February 1, 2019 Are you encountering a performance issue with the method you are using? Quote Link to comment Share on other sites More sharing options...
mawi1512 Posted February 2, 2019 Author Share Posted February 2, 2019 On 1/31/2019 at 9:15 PM, bubamara said: sprite with another slightly smaller sprite as it's child I already had the idea, but somehow it feels like a workaround, not a native solution and I asked myself if there is no other native solution. But if the experts here in the forum also suggest it, then I'll take a closer look at it. 19 hours ago, xerver said: Are you encountering a performance issue with the method you are using? I can't answer that question with a clear yes or no. In my project the number of rectangles to draw depends on the users data model. And on large models there is a noticeable difference between normal sprite rect and a border rect with NineSlicePlane. Therefore my question how to get the difference smaller . Thank you for your fast answers... Quote Link to comment Share on other sites More sharing options...
bubamara Posted February 2, 2019 Share Posted February 2, 2019 Sorry, I should have been clearer : it depends on your use case and Pixi version. For example if you are using Pixi 4.x and mixing up NineSlicePlane with Sprites, then above mentioned Sprite-Sprite approach should be noticeably faster. Pixi 5.x can batch mesh (NineSlice) with Sprite, thus making speed difference less visible. On the other hand Pixi 4 seems to have better raw performance than v5, feel free to compare yourself : https://themoonrat.github.io/webgl-benchmark/ And when you have mentioned that you are updating them often, then it's another reason to try pure sprites approach. Anyway, would love to hear your conclusion if you find a time to compare :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.