0
votes

AFAIK, WebGL2 doesn't have a limitation with texture sizes which should be power of 2 in WebGL1. But, with WebGL2, I have tried to generate mipmaps for compressed textures in DDS format with custom sizes (not power of 2) and always got an exception: "level 0 not power of 2...". I've tried with one mipmap level and miltiple levels. No luck. It only works when the sizes are power of 2. Does anybody know why? I've it tried with mipmaps created with a tool like imagemagick and mipmaps generated at runtime with gl.generateMipmap(target). No luck.

1
I know little about WebGL2 mipmaps, but did you disable CLAMP_TO_EDGE so that it can use "virtual-pixels" past the edge by extending the image via duplications or mirror or some other extension method? - fmw42
Don't use DDS on daily basis and as far as i recall DXTn uses 4x4 blocks (according to wikipedia) and has to be power of two, but this limitation also can comes from your hardware. Have your tried to validate your texture with external tools link. How you load your texture exactly to be draw on a Full Screenquad texture reference or something else ? - nabr
@fmw42 I didn't use CLAMP_TO_EDGE. I only set TEXTURE_MAG_FILTER and TEXTURE_MIN_FILTER - Oleg
Might CLAMP_TO_EDGE be the default? Also, WebGL2 may support that, but does DDS format support it? - fmw42
@Nabr What do you mean with "Don't use DDS on daily basis"? I just want compressed images with mipmaps, so that the image quality looks good while zooming in / out (achieved with scaling matrix). I use quite normally shader described in webgl2fundamentals webgl2fundamentals.org/webgl/lessons/webgl-3d-textures.html DDS with mipmaps was created with Compressonator compressonator.readthedocs.io/en/latest/gui_tool/index.html I also used parse-dds to parse DDS. Here is an example: github.com/Jam3/parse-dds/blob/master/demo/index.js - Oleg

1 Answers

0
votes

DXT definetely works for non-POT textures. It uses 4x4 blocks, so it works fine on any image whose dimensions are multiples of 4. You have to follow this rule. Originally, my texture didn't have the width / height as multiple of 4. I've tried DXT5 with width / height of mip levels which are multiples of 4 and everything works fine. Thanks.