attach camera to hidden buffer

Just trying to attach a cam to an hidden buffer:

PT(GraphicsBuffer) Buffer = DCAST(GraphicsBuffer,window->get_graphics_output()->make_texture_buffer("Buffer",Width,Height)); 
PT(Texture) Buffertexture = Buffer->get_texture();
PT(Camera)  cam1 = new Camera("cam1");
NodePath cam1NP = camera.attach_new_node(cam1);
Buffer->set_sort(-200);
cam1->set_scene(render);
Buffer->set_camera(cam1NP); // DOES THIS EXIST similar to what I'd do if it was a real displayRegion ?????

What’s the correct way to assign the camera to the hidden buffer?

Create a display region for the buffer, and then assign the camera to that. I think you can do so using buffer->make_display_region.

Thank you rdb,

Here is the modified code in case it can be useful to other Panda3D friends.

It compiles properly, I still have to check it does work properly !

PT(GraphicsBuffer) Buffer = DCAST(GraphicsBuffer,window->get_graphics_output()->make_texture_buffer("Buffer",Width,Height));
PT(Texture) Buffertexture = Buffer->get_texture();
PT(Camera)  cam1 = new Camera("cam1");
NodePath cam1NP = camera.attach_new_node(cam1);
Buffer->set_sort(-200);
cam1->set_scene(render);

Buffer->make_display_region(0,1,0,1);
Buffer->get_display_region(0)->set_camera(cam1NP);