相关疑难解决方法(0)

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万
查看次数

标签 统计

dart ×1

textures ×1

webgl ×1