ImageUtils.loadTexture与Canvas Renderer中的回调 [英] ImageUtils.loadTexture with callback in Canvas Renderer

查看:342
本文介绍了ImageUtils.loadTexture与Canvas Renderer中的回调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Canvas Renderer(IE on Win7)中加载纹理并为onLoad事件添加回调时使用three.js修订版53

i'm using three.js revision 53

不显示。当我删除回调函数时,纹理显示为预期:

when loading a texture in Canvas Renderer (IE on Win7) and adding a callback for the onLoad event, the texture is not getting displayed. When i remove the callback function, the texture is getting displayed as expected:

//不使用回调添加

var material = new THREE.MeshBasicMaterial({
            map: THREE.ImageUtils.loadTexture('text_build.png', {}, function()
            {
 //do something
            })
});
var plane = new THREE.Mesh(new THREE.PlaneGeometry(135, 135), material);
plane .overdraw = true;
scene.add(plane );

// WORKING without callback

// WORKING without callback

var material = new THREE.MeshBasicMaterial({
             map: THREE.ImageUtils.loadTexture('text_build.png')
});
var plane = new THREE.Mesh(new THREE.PlaneGeometry(135, 135), material);
plane .overdraw = true;
scene.add(plane );



当在WebGL Renderer(FF,WIn7中的Chrome)上运行相同的代码时, 。

When running the same code in WebGL Renderer (FF,Chrome on WIn7), both examples work just fine.

也许有人可以指出我在这里显然做错了。

Maybe someone can point me to the mistake i'm obviously doing here.

非常感谢。

推荐答案

尝试:

var material = new THREE.MeshBasicMaterial({    
    map: THREE.ImageUtils.loadTexture( 'text_build.png', new THREE.UVMapping(), function() { ... } )
});

这篇关于ImageUtils.loadTexture与Canvas Renderer中的回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆