相关疑难解决方法(0)

WebGL - 等待纹理加载

如何测试WebGLTexture对象是否"完整"?

目前我收到此消息: [WebGLRenderingContext]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete'

我得到这个警告,因为渲染循环试图在其图像加载完成之前使用纹理,那么如何解决这个问题呢?

html5 textures webgl

14
推荐指数
1
解决办法
1万
查看次数

dart:web_gl:RENDER警告:绑定到纹理单元0的纹理不可渲染

我得到的错误[.WebGLRenderingContext]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete',当我在dartium运行我的web应用程序.我一直在尝试解决这个问题两天,包括完全重写代码,但我不能隔离这个问题.

我认为问题在于这段代码.

  void main() {
  ...
    var texture = gl.createTexture();
    var image = new ImageElement();
    image.onLoad.listen((e) {
      gl.bindTexture(webGL.TEXTURE_2D, texture);
      gl.texImage2DImage(webGL.TEXTURE_2D, 0, webGL.RGBA, webGL.RGBA, 
                       webGL.UNSIGNED_BYTE, image);
      gl.texParameteri(webGL.TEXTURE_2D, webGL.TEXTURE_MAG_FILTER, webGL.NEAREST);
      gl.texParameteri(webGL.TEXTURE_2D, webGL.TEXTURE_MIN_FILTER, webGL.NEAREST);
      gl.bindTexture(webGL.TEXTURE_2D, null);
    });
    image.src = "tex.png";
  ...
  }
Run Code Online (Sandbox Code Playgroud)

tex.png是32x32

关于问题是什么的任何想法?

textures webgl dart

10
推荐指数
1
解决办法
3万
查看次数

三个JS TextureLoader

我试图将纹理添加到我转换为json并从3ds Max导入的模型.我搜索但没有找到任何在线使用three.js r53将纹理应用于json模型的代码.我想Three.js处理纹理的方式与以前的版本有所不同.任何指导?

以下是我的代码:

var texloader = new THREE.TextureLoader();
var tex=texloader.load("second.jpg");
var mat = new THREE.MeshBasicMaterial({ map: tex });

loader = new THREE.JSONLoader();
loader.load( "js/JsonModels/toothz.js", function( geometry, mat ) {
    mat[0].shading = THREE.SmoothShading;
    var material = new THREE.MeshFaceMaterial( mat);
    mesh = new THREE.Mesh( geometry, material );
    mesh.scale.set( 3, 3, 3 );
    mesh.position.y = 0;
    mesh.position.x = 0;
    scene.add( mesh );
} );
Run Code Online (Sandbox Code Playgroud)

textures webgl three.js

3
推荐指数
2
解决办法
2万
查看次数

标签 统计

textures ×3

webgl ×3

dart ×1

html5 ×1

three.js ×1