pixijs / pixi-compressed-textures

Compressed textures and retina support for pixijs. Loader can choose textures depends on platform and rendering mode.
MIT License
93 stars 25 forks source link

Unable to load etc1 (pvr) texture #15

Open mityok opened 7 years ago

mityok commented 7 years ago

I'm trying to use compressed textures in mobile application. and i'm unable to load etc1 texture, i'm getting those warnings and a black square: WebGL: INVALID_ENUM: compressedTexImage2D: invalid format CompressedImage.generateWebGLTexture @ pixi-compressed-textures.js:22303 [.Offscreen-For-WebGL-0xdd8fe800]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.

this is the code i'm using:

var extensions = PIXI.compressedTextures.detectExtensions(app.renderer);
var loader = new PIXI.loaders.Loader();
loader.pre(PIXI.compressedTextures.imageParser());
loader.add('shannon', 'data/shannon-etc1.pvr');
loader.load(function(loader, resources) {
    var sprite = new PIXI.Sprite(resources['shannon'].texture);
    app.stage.addChild(sprite);
});

and the pvr file is taken from this site, witch shows pvr (etc1) just fine on my tablet

ivanpopelyshev commented 7 years ago

OK, I'll try to look at it on my android phone. Actually, I didnt check if ETC1 is working in this plugin at all.

ivanpopelyshev commented 7 years ago

We have to check if program goes there: https://github.com/pixijs/pixi-compressed-textures/blob/master/src/CompressedImage.js#L294

mityok commented 7 years ago

yes, it enters into that case

andrewstart commented 7 years ago

On your GL context (app.renderer.gl, I think), try calling gl.getExtension('WEBGL_compressed_texture_etc1'). It looks like we aren't checking for the ETC extension, so I assume that manually enabling the extension will work.

mityok commented 7 years ago

yes, that worked, adding etc: getExtension(gl, "WEBGL_compressed_texture_etc1") fixed it

EloB commented 6 years ago

I'm also trying to use etc1 but getting "Uncaught Compressed texture format is not recognized". Never used etc1 before. So maybe I'm doing some wrong thing. Which tool do you use to create etc1 files and if command line how do you write?

This file was working but I have no idea how they built it. http://toji.github.io/texture-tester/textures/shannon-etc1.pvr I will be super happy if you can pin point me in the right direction :)

eXponenta commented 5 years ago

pvrtc with etc1 encoding isn't raw etc1. pvrtc - is container for different encodings formats.