binarez Posted April 4, 2017 Share Posted April 4, 2017 Hi all, BabylonJS is great. I have a question, maybe someone here can help : Is it possible with the current API (BJ2.5 ou 3) to write directly to the ArrayBuffer used to upload data to the video card? In my program, I would like to generate and update a dynamic mesh and I need it to happen as fast as possible (no freezing, eventually might have to be done in a web worker). In fact, quite often actually, I need to update muliple meshes at once within a frame. I'm worried about the overhead of updating a JS array that, I'm guessing, is copied into an ArrayBuffer to feed to webgl. Can I bypass the JS data format? I would like to "lock" the buffer and write to it. Am I overworrying? I think not. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 5, 2017 Share Posted April 5, 2017 Hello no need to be worried, when you have an updatable mesh, this code is used: https://github.com/BabylonJS/Babylon.js/blob/master/src/Mesh/babylon.buffer.ts#L87 And as you can see here, if you provide a float32array, it will be uploaded directly with no overhead: https://github.com/BabylonJS/Babylon.js/blob/master/src/babylon.engine.ts#L1346 Quote Link to comment Share on other sites More sharing options...
jerome Posted April 5, 2017 Share Posted April 5, 2017 I confirm ... this is exactly the way the Dynamic Terrain and the SPS work 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.