private void checkNonPowerOfTwo(Texture tex) {
        if (!tex.getImage().isNPOT()) {
            // Texture is power-of-2, safe to use.
            return;
        }

        if (caps.contains(Caps.NonPowerOfTwoTextures)) {
            // Texture is NPOT, but it is supported by video hardware.
            return;
        }

        // Maybe we have some / partial support for NPOT?
        if (!caps.contains(Caps.PartialNonPowerOfTwoTextures)) {
            // Cannot use any type of NPOT texture (uncommon)
            throw new RendererException("non-power-of-2 textures are not "
                    + "supported by the video hardware");
        }

        // Partial NPOT supported..
        if (tex.getMinFilter().usesMipMapLevels()) {
            throw new RendererException("non-power-of-2 textures with mip-maps "
                    + "are not supported by the video hardware");
        }

        switch (tex.getType()) {
            case CubeMap:
            case ThreeDimensional:
                if (tex.getWrap(WrapAxis.R) != Texture.WrapMode.EdgeClamp) {
                    throw new RendererException("repeating non-power-of-2 textures "
                            + "are not supported by the video hardware");
                }
                // fallthrough intentional!!!
            case TwoDimensionalArray:
            case TwoDimensional:
                if (tex.getWrap(WrapAxis.S) != Texture.WrapMode.EdgeClamp
                        || tex.getWrap(WrapAxis.T) != Texture.WrapMode.EdgeClamp) {
                    throw new RendererException("repeating non-power-of-2 textures "
                            + "are not supported by the video hardware");
                }
                break;
            default:
                throw new UnsupportedOperationException("unrecognized texture type");
        }
    }
Validates if a potentially NPOT texture is supported by the hardware.
<p>
Textures with power-of-2 dimensions are supported on all hardware, however
non-power-of-2 textures may or may not be supported depending on which
texturing features are used.

@param tex The texture to validate.
@throws RendererException If the texture is not supported by the hardware
jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java