private void checkSetTexture(Texture tex, boolean depth) {
        Image img = tex.getImage();
        if (img == null) {
            throw new IllegalArgumentException("Texture not initialized with RTT.");
        }

        if (depth && !img.getFormat().isDepthFormat()) {
            throw new IllegalArgumentException("Texture image format must be depth.");
        } else if (!depth && img.getFormat().isDepthFormat()) {
            throw new IllegalArgumentException("Texture image format must be color/luminance.");
        }

        // check that resolution matches texture resolution
        if (width != img.getWidth() || height != img.getHeight()) {
            throw new IllegalArgumentException("Texture image resolution "
                    + "must match FB resolution");
        }

        if (samples != tex.getImage().getMultiSamples()) {
            throw new IllegalStateException("Texture samples must match framebuffer samples");
        }
    }
Enables the use of a color buffer for this <code>FrameBuffer</code>.

@param format The format to use for the color buffer.
@throws IllegalArgumentException If <code>format</code> is not a color format.
@deprecated Use addColorTarget
jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java