MasterK Posted July 28, 2016 Share Posted July 28, 2016 I develop a new Primitive type MY_PRIM base on RenderablePrim2D. And it almost same as Sprite2D It works right. But in this case: create two screenCanvas, add MY_PRIM to each one. delete one screenCanvas, there will be webgl errors. And other screenCanvas's MY_PRIM object is not display. WebGL: INVALID_OPERATION: uniform1i: location not for current program babylon.engine.js:1010 WebGL: INVALID_OPERATION: drawElementsInstancedANGLE: no valid shader program in use And if use Sprite2D instead of MY_PRIM, there will be no error and display ok. @Nockawa What should i take care of to develop a new Primitive type??? Quote Link to comment Share on other sites More sharing options...
Wingnut Posted July 28, 2016 Share Posted July 28, 2016 Hi again MK. Could you make a playground that shows the problem? That would probably help Nockawa and make it easy for others to learn, too. thx! Quote Link to comment Share on other sites More sharing options...
MasterK Posted July 29, 2016 Author Share Posted July 29, 2016 http://babylonjs-playground.com/#E5BQM#9 I create in playground, but dont reproduce the error... And in another computer, there will be same error by chance... And I try to directly modify babylon.sprite2d.js in my local environment. And the error appears!!!! And I try to get back the original js file, The error didn't disappear!!!!! So confused... Because before i change the file, there's no error with babylon.sprite2d.js I think it's a bit hard for you to understand... Just look at the PG and check my primtive class ... I dont think the code has problem. The sprite's texture must be the root of the problem. as it used by effect. Quote Link to comment Share on other sites More sharing options...
MasterK Posted July 29, 2016 Author Share Posted July 29, 2016 And another question maybe more clear: http://babylonjs-playground.com/#WEGLG#2 can't dispose sprite in canvas2d. tried setting Group2D.GROUPCACHEBEHAVIOR_DONTCACHEOVERRIDE for WSC, no effect. Quote Link to comment Share on other sites More sharing options...
MasterK Posted July 29, 2016 Author Share Posted July 29, 2016 I track the code. And find when worldSpaceCanvas's sprite2d dispose, the sprite2d effect and effectInstance was release, So another ScreenCanvas's sprite2d's same effect is diabled. Is that OK? I'm not sure, just ask. ================================================ @Nockawai see you fixed... I'll update. Quote Link to comment Share on other sites More sharing options...
Nockawa Posted July 29, 2016 Share Posted July 29, 2016 3 hours ago, MasterK said: I track the code. And find when worldSpaceCanvas's sprite2d dispose, the sprite2d effect and effectInstance was release, So another ScreenCanvas's sprite2d's same effect is diabled. Is that OK? I'm not sure, just ask. ================================================ @Nockawai see you fixed... I'll update. Yep, I've fixed it, I didn't knew how Effect instance were managed internally, after talking with DK the best thing to do was not releasing the Effect, it's useless. Quote Link to comment Share on other sites More sharing options...
MasterK Posted July 30, 2016 Author Share Posted July 30, 2016 11 hours ago, Nockawa said: Yep, I've fixed it, I didn't knew how Effect instance were managed internally, after talking with DK the best thing to do was not releasing the Effect, it's useless. Dispose problem is solved. Still sprite2d not display problem... Sometime Sprite2DRenderCache.render is not called...And no display... Quote Link to comment Share on other sites More sharing options...
MasterK Posted July 30, 2016 Author Share Posted July 30, 2016 when render sprite2d: in Group2D.prototype._groupRender : this._renderableData._renderGroupInstancesInfo.forEach(function (k, v) { // Prepare the context object, update the WebGL Instanced Array buffer if needed var renderCount = _this._prepareContext(engine, context_1, v); in Group2D.prototype._prepareContext renderCount += array.usedElementCount; (when usedElementCount = 0 not display (very much time happens), when usedElementCount = 1 , it display) Quote Link to comment Share on other sites More sharing options...
Nockawa Posted July 30, 2016 Share Posted July 30, 2016 I spotted the issue, if was due to something else, I hope the code is stable now. Quote Link to comment Share on other sites More sharing options...
MasterK Posted July 30, 2016 Author Share Posted July 30, 2016 48 minutes ago, Nockawa said: I spotted the issue, if was due to something else, I hope the code is stable now. first ready display is ok now. But when i dispose a sprite2d from WSC, it's not disappear. Quote Link to comment Share on other sites More sharing options...
Nockawa Posted July 30, 2016 Share Posted July 30, 2016 44 minutes ago, MasterK said: first ready display is ok now. But when i dispose a sprite2d from WSC, it's not disappear. Ok it's fixed with the commit: https://github.com/BabylonJS/Babylon.js/pull/1287/commits/c05e2683b97ecfedfd20aec0561109ecf73e440d A PR is on its way. MasterK 1 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.