library(rggobi)
mkRandu <- function(N)
{
    ## N successive pairs from the IBM RANDU pseudo-random number generator
    res <- numeric(N + 2)
    res[1] <- 1
    M <- 2^31
    for(i in 2+(0:N)) res[i] <- (65539*res[i-1]) %% M
    res <- res/M
    embed(res, 3)
}

## NB: when ggobi is running it tends to block everything,
## so *pause* the display when it opens up, then un-pause it.

randu <- mkRandu(1000)
gg <- ggobi(randu)
glyph_colour(gg$randu) <- 9
d <- displays(gg)[[1]]
pmode(d) <- "Rotation"
# filled circles are slow on Windows
glyph_size(gg$randu) <- 1
glyph_type(gg$randu) <- 7

close(gg)

# try more points
randu <- mkRandu(20000)
gg <- ggobi(randu)
glyph_colour(gg$randu) <- 9
# filled circles are slow on Windows
glyph_type(gg$randu) <- 1  # faster
d <- displays(gg)[[1]]
pmode(d) <- "Rotation"

close(gg)

randu <- mkRandu(100000)
library(rgl)
plot3d(randu)
## zoom with scroll wheel, rotate with mouse movement.
