r-lidar-lab / lidRviewer

An OpenGL point cloud viewer for R able to handle several millions of points
75 stars 16 forks source link

installation on macOS #7

Closed slowkow closed 4 years ago

slowkow commented 4 years ago

I successfully installed on macOS. But the package still doesn't work.

First I installed the dependencies:

brew install sdl
brew install freeglut

I changed some of the source files like so:

#if defined(__APPLE__)
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#include <GL/glu.h>
#endif

Then I deleted src/Makevars. Next, I created a configure file in the root folder:

#!/bin/bash
if [ $(uname) == "Linux" ]
then
  echo 'PKG_LIBS= -lGL -lGLU -lSDL -LSDmain' > ./src/Makevars
elif [ $(uname) == "Darwin" ]
then
  echo 'PKG_LIBS= -framework OpenGL -lSDL' > ./src/Makevars
fi

Now I can successfully install PointCloudViewer with:

R -e 'devtools::install(".")'

Finally, I tried an example to see if it worked:

#!/usr/bin/env Rscript

library(PointCloudViewer)

x   <- runif(1000, 0, 100)
y   <- runif(1000, 0, 100)
z   <- runif(1000, 0, 100)
col <- rainbow(10)
id  <- sample(1:10, length(x), replace = TRUE)
plot_xyzcol(x, y, z, col, id)

I can see the message Point cloud viewer must be closed before to run other R code, but I don't see any viewer.

Do you know what I might be missing?

Jean-Romain commented 4 years ago

Sorry I don't know. And I can't reproduce issues on MacOS so I won't be able to help you by any mean. I don't know how to install it on MacOS. This is why you didn't find instructions in the README. If you figure out how to make it working please tell me so I can update the instructions. So far what you did looks good but I have no clue why no windows opened.