如何关闭rgl X11 windows?

问题描述 投票:3回答:2

我想用rgl包创建一个3D动画。我的代码是这样的:

for (frame in 1:100) {
    open3d()
    ... # run some commands here for plotting, like points3d() or spheres3d()
     # Now, save the frame to a png file
    rgl.snapshot(paste0("Frame",sprintf("%04d",frame),".png"))     
}

它工作正常,并在每个帧的PNG文件中创建一个快照。但在那之后,将有100个开放的X11窗口。另一个问题是,我想打开许多窗户的运行时间会太高。

我尝试使用rgl.close()clear3d(),没有一个工作正常(他们使输出png文件为黑色)。

反正呢?

r animation window rgl
2个回答
3
投票

我意识到这是一个老问题,但这是我提出的关闭所有rgl windows的简单解决方案。

while (rgl.cur() > 0) { rgl.close() }

0
投票

#rgl.close()...工作正常,并且是自我解释的

3D visualization device system

Description
3D real-time rendering system.
Usage
# Low level rgl.* interface
rgl.open(useNULL = rgl.useNULL())     # open new device
rgl.close()    # close current device
© www.soinside.com 2019 - 2024. All rights reserved.