New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use external VBO #11883
Comments
+1 |
1 similar comment
+1 |
+∞ |
Instead of trying to hack var positions = new THREE.GLBufferAttribute( function ( gl ) {
const vertices = [];
for ( i = 0; i < REAL_SIZE; i ++ ) {
vertices.push( Math.random() * 2000 - 1000 );
vertices.push( Math.random() * 2000 - 1000 );
vertices.push( Math.random() * 2000 - 1000 );
}
const vbo = gl.createBuffer();
gl.bindBuffer( gl.ARRAY_BUFFER, vbo );
gl.bufferData( gl.ARRAY_BUFFER, new Float32Array( vertices ), gl.STATIC_DRAW );
return vbo;
} );
geometry.addAttribute( 'position', positions ); |
Ofcourse that would also do the trick. Even There is one more thing to consider here. WebGL2 is comming (and it already works, sometimes). So This whole feature request is really into GPGPU, be it on Node.js or in browser. Most of the usecases require tackling with VBO here and there. Because no one wants to pass tens to hundreds of megabytes between host and device each frame... Being available as a property of |
Success! Would you like to do a PR adding |
I'd like to. But as I started thinking of it now, I understood that I don't have the full picture.
My guess would be: subclass |
Yep! Sounds like a good start. |
Solved via #13196. |
Hello!
This is a feature request. I want to be able to optionally feed my VBO to three.js
BufferAttribute
. I walked through some (three.js) code and couldn't find any way to do so (from outside).In previous versions of three.js I was able to hack into
renderer.properties
to replace VBO with my custom one. However, after an upgrade to r86 three's VBO are stored in WebGLAttributes module which is not exposed. Since now the storage is hidden from the outside, I can no longer hack into it from my external codes. Therefore I want to legalize such behavior, to prevent further struggles and hacks.An example of what I might do with it is following:
More of it you can see here.
To summarize: sometimes you end up with preallocated GL buffer and a lack of an ability to use it in three.js
BufferGeometry
, where it would fit perflectly.If it sounds reasonable, then I can also show an example of a patch, that makes the above code work:
Just add the condition to see if there is user-defined buffer-creator callback. In WebGLAttributes.js, that's all I need.
If you want me to give more specific reasons for what I do with my buffers, I'll be glad to answer. I can then create a PR with the above changes, if it makes sense.
Three.js version
Browser
OS
Thanks for your time! 😃
The text was updated successfully, but these errors were encountered: