Skip to content

Takes too much RAM loading a texture #1806

Answered by TeamBaconn
TeamBaconn asked this question in Q&A
Discussion options

You must be logged in to vote

Hi everyone, I've combined your code and expo textureloader, its something like this
`export default class ExpoTextureLoader extends THREE.TextureLoader {
load(asset, onLoad, onProgress, onError) {
if (!asset) {
throw new Error('ExpoTHREE.TextureLoader.load(): Cannot parse a null asset');
}
let texture = new THREE.Texture();
(async () => {
const fixAsset = await getAsset(asset).downloadAsync()
function parseAsset(image) {
texture.image = image;
texture.needsUpdate = true;
}

        texture['isDataTexture'] = true; // Disable this, texture will not be shown but it wont take too much memory
        parseAsset({
            data: fixAsset,
            width: fixAsset.width,
            heigh…

Replies: 4 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@TeamBaconn
Comment options

Comment options

You must be logged in to vote
4 replies
@CodyJasonBennett
Comment options

@TeamBaconn
Comment options

@CodyJasonBennett
Comment options

@TeamBaconn
Comment options

Answer selected by TeamBaconn
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #1805 on November 05, 2021 19:56.