【问题标题】:How to close rgl X11 windows?如何关闭 rgl X11 窗口?
【发布时间】:2014-11-26 03:04:13
【问题描述】:

我想用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 文件变为黑色)。

还有吗?

【问题讨论】:

  • 你试过movie3d() ...吗?
  • 最后我把 open3d() 替换为 clear3d() 让它工作了。
  • 不妨将其作为解决方案发布...

标签: r animation window rgl


【解决方案1】:

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

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

【讨论】:

【解决方案2】:

# 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

【讨论】:

    猜你喜欢
    • 2010-09-08
    • 2021-10-28
    • 2023-01-24
    • 1970-01-01
    • 2023-03-07
    • 1970-01-01
    • 1970-01-01
    • 2021-06-02
    • 2010-09-11
    相关资源
    最近更新 更多