Fork me on GitHub

Non-Power-of-Two Textures in x3dom

15.10.2010 Uncategorized

There are issues with non-power-of-two textures while using x3dom with the WebGL-Backend. OpenGL ES 2.0 supports non-power-of-two textures in general but with some restrictions. The wrap mode can only be GL_CLAMP_TO_EDGE and mipmap must be off. Just run this example to test the behaviour in your browser. The filter settings are part of the X3D spec and the default values do not clamp. Therefore you have to change the repeatS and repeatT settings to false for non-power-of-two textures. If you use power-of-two textures both settings should work.

Using the x3d ImageTexture:

<imageTexture repeatS=’false’ repeatT=’false’ url=’foo.jpg’>
</imageTexture>

Using the x3dom <texture> extention:

<texture repeatS=’false’ repeatT=’false’>
<img src=’foo.jpg’>
</texture>

This may change in the future if we have access to the WebGL-extensions and find something like GL_OES_texture_npot