# \[Help\] Can't add and fit a canvas texture on GLB model

**URL:** <https://discourse.threejs.org/t/help-cant-add-and-fit-a-canvas-texture-on-glb-model/33666>\
**Category:** Questions\
**Tags:** textures, materials\
**Created:** [January 15, 2022, 9:48am UTC](https://discourse.threejs.org/t/help-cant-add-and-fit-a-canvas-texture-on-glb-model/33666 "2022-01-15T09:48:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DidoMarchet](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/didomarchet/32/9136_2.png) [@DidoMarchet](https://discourse.threejs.org/u/DidoMarchet)\
**Post date:** [January 15, 2022, 9:48am UTC](https://discourse.threejs.org/t/help-cant-add-and-fit-a-canvas-texture-on-glb-model/33666/1 "2022-01-15T09:48:20Z")

</div>

Hi guys!  
I’m not able to add a texture on my GLTF model.  
I get inspired by this repo: [GitHub - devramkumardnagarajan/3d-Tshirt-design: Design Tshirt's using Three.js](https://github.com/devramkumardnagarajan/3d-Tshirt-design)  
and I convert the OBJ model used by the author to GLB.

The model converted to GLB:  
[model-1.glb](https://discourse.threejs.org/uploads/short-url/yBEgHLmm51hFflp9oneX8OaEYT4.glb) (1.3 MB)

and the SVG texture:  
 ![graphic-1](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/5/7/578039b179287b8a223a8977ad3e8c1767bf0559.svg)

Basically:  
1 - ​I load my model and I center it on the stage ([[Help] Loaded model placed very far away - #4 by DidoMarchet](https://discourse.threejs.org/t/help-loaded-model-placed-very-far-away/33586/4)).

2 - I load my SVG with the SVGLoader and I place it on a canvas

3 - I pass this canvas as texture and I set the material:

```javascript
const texture = new THREE.Texture(canvas)
        texture.needsUpdate = true
        texture.flipY = false
        const material = new THREE.MeshPhongMaterial({ map: texture })
        
        this.meshes.forEach((mesh) => {
          mesh.material = material
        })

```

When I render the scene the stage become white (the render “disappear”).

If I try to add the texture here [https://brushhh.blogspot.com/](https://brushhh.blogspot.com/) with the same model (in OBJ not GLB), the texture fit perfectly.  
This is the OBJ version of the file:  
[model-1.obj](https://discourse.threejs.org/uploads/short-url/aSMfxrE32w9Iqyl9pqlHfZdEXrv.obj) (3.9 MB)

In conclusion my question is:  
how can I add correctly a canvas texture on my model and make it fit on the model?

Any examples or advices are welcome  
and thanks so much.

Regards,

Davide

---

<div class="post-metadata">

**Author:** ![DidoMarchet](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/didomarchet/32/9136_2.png) [@DidoMarchet](https://discourse.threejs.org/u/DidoMarchet)\
**Post date:** [January 17, 2022, 10:01am UTC](https://discourse.threejs.org/t/help-cant-add-and-fit-a-canvas-texture-on-glb-model/33666/2 "2022-01-17T10:01:16Z")

</div>

It was my mistake, I forget to load the image

```javascript
[....]
img.onload = () => {
          ctx.drawImage(img, 0, 0)

          texture.needsUpdate = true
        const material = new THREE.MeshPhongMaterial({ map: texture })
        
        this.meshes.forEach((mesh) => {
          mesh.material = material
        })
        }

```
