pixi-compressed-textures icon indicating copy to clipboard operation
pixi-compressed-textures copied to clipboard

Unable to load etc1 (pvr) texture

Open mityok opened this issue 7 years ago • 7 comments

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

mityok avatar Oct 16 '17 13:10 mityok

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 avatar Oct 16 '17 14:10 ivanpopelyshev

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

ivanpopelyshev avatar Oct 16 '17 14:10 ivanpopelyshev

yes, it enters into that case

mityok avatar Oct 16 '17 17:10 mityok

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.

andrewstart avatar Oct 17 '17 02:10 andrewstart

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

mityok avatar Oct 17 '17 08:10 mityok

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 :)

EloB avatar Oct 15 '18 18:10 EloB

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

eXponenta avatar Sep 18 '19 00:09 eXponenta