[R] rgl: How to position a window during open3d call
Duncan Murdoch
murdoch at stats.uwo.ca
Wed Sep 17 19:49:38 CEST 2008
On 9/17/2008 1:13 PM, Koen Stegen wrote:
> Dear all,
>
> The documentation on the function open3d in the rgl package, reads:
>
> open3d opens a new rgl device, and sets the parameters as requested.
>
> I want the new rgl device (window) to be sized and positioned in a specific
> place on my screen. So, I try to set the "windowRect" parameter as follows:
>
> > library("rgl")
> > open3d(windowRect=c(100,100,500,500))
> [1] 1
>
> Obviously you can't see where the window appears, so I'll ask for the
> "windowRect" parameter:
>
> > par3d()["windowRect"]
> $windowRect
> [1] 2300 764 2556 1020
>
> As you can see, the window is not positioned at (100,100) nor is the size
> 400x400. The size is the default 256x256 and the position is where the window
> manager would put a new window if its position is unspecified.
> [note: I have a dual screen setup so the coordinates are not bogus]
>
> If, however, I use par3d to set the "windowRect", the window goes where it is
> supposed to go:
>
> > par3d(windowRect=c(100,100,500,500))
> > par3d()["windowRect"]
> $windowRect
> [1] 104 125 504 525
>
> The (4,25) pixels offset are the border and title bar of the window.
>
> For completeness sake:
> This behavior occurs on both Windows+ATI, Linux+ATI, Linux+NVidia.
> On Windows is R version 2.7.2, and rgl version 0.81 (installed today).
>
> Does anyone know how to set the windowRect parameter during an open3d call?
Looks like a bug. The open3d function is defined as
> open3d
function (..., params = get("r3dDefaults", envir = .GlobalEnv))
{
rgl.open()
clear3d("material", defaults = params)
params$material <- NULL
if (!is.null(params$bg)) {
do.call("bg3d", params$bg)
params$bg <- NULL
}
do.call("par3d", params)
return(rgl.cur())
}
<environment: namespace:rgl>
and you'll notice that the ... parameters are never used. Not sure when
this error crept in...
The workaround is simply to use par3d() after open3d().
Duncan Murdoch
>
>
> Thanks in advance,
>
> Koen Stegen
> Royal Meteorological Institute of Belgium
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list