private ViewPort setupViewBuffers(Camera cam, String viewName) {
        // TODO this function is identical to that in VRViewManagerOpenVR; merge the two.
        if (environment != null) {
            if (environment.getApplication() != null) {
                ViewPort viewPort = environment.getApplication().getRenderManager().createPreView(viewName, cam);
                viewPort.setClearFlags(true, true, true);
                viewPort.setBackgroundColor(ColorRGBA.Black);

                Iterator<Spatial> spatialIter = environment.getApplication().getViewPort().getScenes().iterator();
                while (spatialIter.hasNext()) {
                    viewPort.attachScene(spatialIter.next());
                }

                // The target view buffer will be set during prerender.
                return viewPort;
            } else {
                throw new IllegalStateException("This VR environment is not attached to any application.");
            }
        } else {
            throw new IllegalStateException("This VR view manager is not attached to any VR environment.");
        }
    }
Set up the cameras and views for each eye and the mirror display.
jme3-vr/src/main/java/com/jme3/input/vr/oculus/OculusViewManager.java