简体   繁体   English

处理带有three.js的纹理

[英]Disposing of a texture with three.js

I'm trying to dispose of a texture after loading it in three.js. 我试图在将它加载到three.js后处理纹理。 I load it with 我加载它

var tex = THREE.ImageUtils.loadTexture("image.png");

and it displays fine. 它显示正常。 But when I try: 但是当我尝试:

tex.dispose();

I get "Uncaught TypeError: Object [object Object] has no method 'dispose'" every time. 我得到“Uncaught TypeError:Object [object Object]每次都没有方法'dispose'”。

Am I missing something? 我错过了什么吗?

Thanks 谢谢

It should work. 它应该工作。 See https://github.com/mrdoob/three.js/blob/master/src/textures/Texture.js#L83 请参阅https://github.com/mrdoob/three.js/blob/master/src/textures/Texture.js#L83

However, you might be using an older version of three.js that still used deallocate() ..? 但是,您可能正在使用仍旧使用deallocate()的旧版本的three.j ..?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM