Sign in to follow this  
binarez

Writing mesh data directly into arraybuffer

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.