protected ByteBuffer pull(FrameBuffer fb, Texture env, int faceId) {

        if (fb.getColorTarget().getFormat() != env.getImage().getFormat())
            throw new IllegalArgumentException("Format mismatch: " + fb.getColorTarget().getFormat() + "!=" + env.getImage().getFormat());

        ByteBuffer face = BufferUtils.createByteBuffer(fb.getWidth() * fb.getHeight() * (fb.getColorTarget().getFormat().getBitsPerPixel() / 8));
        renderManager.getRenderer().readFrameBufferWithFormat(fb, face, fb.getColorTarget().getFormat());
        face.rewind();

        while (bos.size() <= faceId) {
            bos.add(null);
        }

        ByteArrayOutputStream bo = bos.get(faceId);
        if (bo == null) {
            bos.set(faceId, bo = new ByteArrayOutputStream());
        }
        try {
            byte array[] = new byte[face.limit()];
            face.get(array);
            bo.write(array);
        } catch (Exception ex) {
            LOG.log(Level.SEVERE, null, ex);
        }
        return face;
    }
Pulls the data from the framebuffer into the texture Nb. mipmaps must be
pulled sequentially on the same faceId.

@param fb
           the framebuffer to pull from
@param env
           the texture to pull into
@param faceId
           id of face if cubemap or 0 otherwise
@return the ByteBuffer containing the pulled data
jme3-core/src/main/java/com/jme3/environment/baker/GenericEnvBaker.java