# How can I call the BufferGeometryUtils?

**URL:** <https://discourse.threejs.org/t/how-can-i-call-the-buffergeometryutils/3771>\
**Category:** Questions\
**Tags:** buffergeometry\
**Created:** [August 14, 2018, 1:25am UTC](https://discourse.threejs.org/t/how-can-i-call-the-buffergeometryutils/3771 "2018-08-14T01:25:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mihael](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@mihael](https://discourse.threejs.org/u/mihael)\
**Post date:** [August 14, 2018, 1:25am UTC](https://discourse.threejs.org/t/how-can-i-call-the-buffergeometryutils/3771/1 "2018-08-14T01:25:38Z")

</div>

Hi!!

I tried to merge two geometries pre-loaded from two PLY files, the console told me should be use the

> BufferGeometryUtils.mergeBufferGeometries()

for merge de two geometries into one, but I some problems for call this from the class.

Here is my code

```
var scene = new THREE.Scene(); 
var singleGeometry, material, mesh;
var loader = new THREE.PLYLoader();

function loadPLY(path) {
  return new Promise(resolve => {
    loader.load(path, result => {
       console.log('Success');
        resolve(result);
    });
 });

 }

init();

   Promise.all([
 loadPLY("ply/ply1.ply"),
 loadPLY("ply/ply2.ply")
   ])
   .then(geometries => {
  geometries.forEach(geometry => geometry.computeVertexNormals());
    singleGeometry = new THREE.BufferGeometry();
    singleGeometry = THREE.BufferGeometryUtils.mergeBufferGeometries(geometries);   

 material = new THREE.MeshPhongMaterial({color: 0x0055ff });
 mesh = new THREE.Mesh(singleGeometry, material);

 mesh.position.y = 1;
 mesh.position.z = 1;
 mesh.position.x = 1;
 mesh.scale.multiplyScalar( 0.0001 );
 mesh.castShadow = true;
 mesh.receiveShadow = true;

scene.add(mesh);

})
 .then(() => {
    animate();
})
.catch(err => {console.error(err);});

but I got this error:

```

`TypeError: "THREE.BufferGeometryUtils is undefined"`

How can I fix it?

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [August 14, 2018, 6:11am UTC](https://discourse.threejs.org/t/how-can-i-call-the-buffergeometryutils/3771/2 "2018-08-14T06:11:05Z")

</div>

BufferGeometryUtils is in the `examples/js` folder, and isn’t included by default in three.js. You can download it and copy it into your project ([https://github.com/mrdoob/three.js/blob/dev/examples/js/BufferGeometryUtils.js](https://github.com/mrdoob/three.js/blob/dev/examples/js/BufferGeometryUtils.js)), or with CommonJS:

```auto
const THREE = window.THREE = require('three');
require('three/examples/js/BufferGeometryUtils.js');
THREE.BufferGeometryUtils.foo();

```

---

<div class="post-metadata">

**Author:** ![mihael](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@mihael](https://discourse.threejs.org/u/mihael)\
**Post date:** [August 14, 2018, 7:21pm UTC](https://discourse.threejs.org/t/how-can-i-call-the-buffergeometryutils/3771/3 "2018-08-14T19:21:14Z")

</div>

thanks\<3

but now a got this error:  
`TypeError: "mergedGeometry.userData is undefined"`

What could be wrong?

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [August 14, 2018, 7:39pm UTC](https://discourse.threejs.org/t/how-can-i-call-the-buffergeometryutils/3771/4 "2018-08-14T19:39:31Z")

</div>

I would guess you’ve got a version of BufferGeometryUtils that doesn’t match your version of three.js, are you using the most recent three.js? If that’s not the issue I think you’ll need to share a running demo of the issue.

---

<div class="post-metadata">

**Author:** ![mihael](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@mihael](https://discourse.threejs.org/u/mihael)\
**Post date:** [August 14, 2018, 7:53pm UTC](https://discourse.threejs.org/t/how-can-i-call-the-buffergeometryutils/3771/5 "2018-08-14T19:53:25Z")

</div>

Your right,

I was using the 92 version of three.js, so I change for the 95 version. But the mesh in the code I can’t see it and the console show me this warning:

`THREE.WebGLShader: gl.getShaderInfoLog() vertex 0:2(12): warning: extension 'GL_ARB_gpu_shader5' unsupported in vertex shader`

---

<div class="post-metadata">

**Author:** ![mihael](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@mihael](https://discourse.threejs.org/u/mihael)\
**Post date:** [August 14, 2018, 9:59pm UTC](https://discourse.threejs.org/t/how-can-i-call-the-buffergeometryutils/3771/6 "2018-08-14T21:59:09Z")

</div>

okay, this is a error from firebox browser because I open my projects on google chrome without problems
