三个js纹理与webGL

时间:2016-10-28 08:13:38

标签: javascript three.js textures webgl

如果将纹理加载到我使用webGL在threeJS中加载的对象,我会收到以下错误:

错误:WebGL:texImage2D:选择的格式/类型包含昂贵的重新格式:0x1908 / 0x1401

有人知道为什么会这样吗?

上传纹理的代码:

  var loaderA = new THREE.ImageLoader( manager );
  loaderA.load('hout.jpg', function ( image ) {

  texture.image = image;
  texture.needsUpdate = true;
  } );


  var loaderB = new THREE.OBJLoader( manager );

  loaderB.load('hoesjes/iphone.obj', function ( object ) {

  object.traverse( function ( child ) {

    if ( child instanceof THREE.Mesh ) {

        //Changing color
        //texture = new THREE.MeshPhongMaterial( { color: 0x686876 } );
        //color.needsUpdate = true;

        //texture
        child.material.map = texture;
        texture.needsUpdate = true;

    }

} );

0 个答案:

没有答案