Joakim Posted July 12, 2016 Share Posted July 12, 2016 Hi I just started using the Text2D class - and I find it very useful! But I found a little problem. If I dispose of a text element and then add another one to the same canvas, the new text is nothing but a black rectangle and I get the following warning in the console: [.CommandBufferContext.Offscreen-MainThread-0493EE88]RENDER WARNING: there is no texture bound to the unit 0 Here is a small example where the phenomenon occurs: http://www.babylonjs-playground.com/#1WJHS0#0 This is a bug right? Or am I just doing something wrong? Is there a workaround? Thank you! Quote Link to comment Share on other sites More sharing options...
Nockawa Posted July 13, 2016 Share Posted July 13, 2016 19 hours ago, Joakim said: Hi I just started using the Text2D class - and I find it very useful! But I found a little problem. If I dispose of a text element and then add another one to the same canvas, the new text is nothing but a black rectangle and I get the following warning in the console: [.CommandBufferContext.Offscreen-MainThread-0493EE88]RENDER WARNING: there is no texture bound to the unit 0 Here is a small example where the phenomenon occurs: http://www.babylonjs-playground.com/#1WJHS0#0 This is a bug right? Or am I just doing something wrong? Is there a workaround? Thank you! Hello, yes, unfortunately it's a known bug which happens for any kinds of Primitives. If you dispose the last primitive of a given type, I release everything but looks like I can't recreate the instances. I don't have time to code right now because I'm moving back in my old house after 2 years of being abroad and I have lots of things to do, but I'll work on it in few days. There's a Trello Card for this bug. Quote Link to comment Share on other sites More sharing options...
Joakim Posted July 13, 2016 Author Share Posted July 13, 2016 Ah, okay. Well, thanks to the information you gave me, the workaround seems to be that if I add a text element off screen (say at (-50,-50)), which I never remove, the problem is solved! But please, if and when you come up with a solution, post here, so I can mark this topic as solved. Thanks! Quote Link to comment Share on other sites More sharing options...
Nockawa Posted July 14, 2016 Share Posted July 14, 2016 9 hours ago, Joakim said: Ah, okay. Well, thanks to the information you gave me, the workaround seems to be that if I add a text element off screen (say at (-50,-50)), which I never remove, the problem is solved! But please, if and when you come up with a solution, post here, so I can mark this topic as solved. Thanks! Will do it. best. Quote Link to comment Share on other sites More sharing options...
Nabroski Posted July 15, 2016 Share Posted July 15, 2016 (edited) Hello why not dealing with opacity? much faster, then - if you want to destroy an element, you also have to write, you own redraw function, its kind of 2d and fun, but slow things down. I would recommend to deprecated the .dispose(), what i most of the time want is just changing text. Not destroying elements.http://www.babylonjs-playground.com/#1WJHS0#2 Edited July 15, 2016 by Nabroski easy peasy Quote Link to comment Share on other sites More sharing options...
Joakim Posted July 16, 2016 Author Share Posted July 16, 2016 Thanks for the tip Nabroski! I actually want to delete it in this case, because I think it is nicer. But your tip about using levelVisible came in handy for another thing I was doing! Quote Link to comment Share on other sites More sharing options...
Nabroski Posted July 16, 2016 Share Posted July 16, 2016 Thank you, i spend hours exploring this, kind of game for me: Glad if someone find my experience helpful, here is a workaround for dispose()http://www.babylonjs-playground.com/#1WJHS0#3 You can also write your own Primitive Type, that fits exactly with challenges of your project http://doc.babylonjs.com/tutorials/How_to_create_your_own_Canvas2D_primitive Best Quote Link to comment Share on other sites More sharing options...
Nockawa Posted July 17, 2016 Share Posted July 17, 2016 14 hours ago, Nabroski said: Thank you, i spend hours exploring this, kind of game for me: Glad if someone find my experience helpful, here is a workaround for dispose()http://www.babylonjs-playground.com/#1WJHS0#3 You can also write your own Primitive Type, that fits exactly with challenges of your project http://doc.babylonjs.com/tutorials/How_to_create_your_own_Canvas2D_primitive Best @Nabroski and @Joakim don't forget about the doc ! The visibility feature is listed in second place of the General Concept Overview section Quote Link to comment Share on other sites More sharing options...
Nockawa Posted July 27, 2016 Share Posted July 27, 2016 Hello guys, I'm working on this one right now, looks like is specific to Text2D after all...Some caching issue (for a change... but if I don't cache, perf will be crap) Quote Link to comment Share on other sites More sharing options...
Nockawa Posted July 27, 2016 Share Posted July 27, 2016 @Joakim and @Nabroski the issue is solved by a new PR submitted, as usual you'll have to wait the PR to be merge and PG update, only DK can update the PG, so it wont happen before at least 7 hours... 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.