cubemap saving on the fly

I’m wondering if there’s a way to capture the cubemap from a scene and apply the cubemap without having to save out to the disk,

right now the only way I know is

cubemapfile = 'tmp/cube_#.jpg' 
base.saveCubeMap(cubemapfile, size = 256)
tex = loader.loadCubeMap(cubemapfile)

Yes. Use base.win.makeCubeMap.
Something like this:

rig = reflective_object.attachNewNode("rig")
buffer = base.win.makeCubeMap("WeaponReflection", 128, rig)

reflective_object.setTexGen(TextureStage.getDefault(), TexGenAttrib.MWorldCubeMap)
reflective_object.setTexture(buffer.getTexture())