question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expose 'attributes' and 'geometries' from WebGLRenderer

See original GitHub issue

If I add these two lines to WebGLRenderer.initGLContext

	_this.attributes = attributes;
	_this.geometries = geometries;

Then I can do this to grab the underlying WebGL vertex and index buffers for my BufferGeometry and populate them from external WebGL code.

            var bufferGeometry = new THREE.BufferGeometry();
            bufferGeometry.setIndex([]);
            bufferGeometry.addAttribute( 'position', new THREE.Float32BufferAttribute([], 3));            
            bufferGeometry.addAttribute( 'normal', new THREE.Float32BufferAttribute([], 3));            
            bufferGeometry.addAttribute( 'uv', new THREE.Uint16BufferAttribute([], 2, true));

            renderer.geometries.update(bufferGeometry);
            var posBuf = renderer.attributes.get(bufferGeometry.attributes['position']).buffer;
            var norBuf = renderer.attributes.get(bufferGeometry.attributes['normal']).buffer;            
            var uvBuf = renderer.attributes.get(bufferGeometry.attributes['uv']).buffer;
            var indexBuf = renderer.attributes.get(bufferGeometry.index).buffer;

Is this a change you guys would consider taking? This is with the goal of getting volumetric video content playing inside of THREE.js scenes.

Thanks! Evan

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
evodabascommented, Aug 9, 2019

Nice 👍 What’s the status of this feature overall, are there plans for #13196 to make it into a release anytime soon?

2reactions
pvaananencommented, May 30, 2019

I just wanted to chip in and say this feature is exactly what I need 😃 We stream geometry in chunks and doing the roundtrip through BufferGeometry really is a pain. The GLBufferAttribute of https://github.com/mrdoob/three.js/pull/13196 also looks pretty good, so that would be totally OK too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WebGLRenderer – three.js docs
The WebGL renderer displays your beautifully crafted scenes using WebGL. ... parameters - (optional) object with properties defining the renderer's ...
Read more >
3D Rendering Using Three.js | Built In
js internally uses a WebGL renderer by exposing a simple API. A Simple Example: Rotating a Cube. Let's start off by creating a...
Read more >
Extending three.js materials with GLSL | by Dusan Bosnjak
Three.js materials all share a common base in order to be able to work with the entire rendering system. All of them share...
Read more >
Introduction | three-elements
three-elements is a small library that provides a Web Components layer for declaratively building Three.js applications. If you're familiar with both Web ...
Read more >
Team:Munich/Hardware/threeJS - iGEM 2018
var attribute = geometry.attributes.position;. if ( attribute !== undefined ) {. for ( i = 0, l = attribute.count; i < l; i...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found