Closed jimjam-slam closed 5 years ago
0.99.16 is not the latest version--there's a newer development version available. Install it using the following and try again:
install.packages("rgl", repos="http://R-Forge.R-project.org")
I removed rayshader
and rgl
and then installed rgl
from the RForge repo (0.100.12) twice: in one session, I installed it this way after rayshader
, and in another, before rayshader
. But in both cases the land didn't render 😕
When I removed both, restarted and reinstalled rayshader
(along with the version of older version of rgl
it points to), the land was rendering again, although of course FreeType support didn't work.
Do you still get the rendering error, or is the issue just with the labels not rendering?
I didn't actually attempt to render the labels! I was hitting the rendering error (ie. no land rendering). I'll give it another crack!
Okay, after removing everything, I have:
freetype.dll
to C:\Windows\System32
rayshader
rgl
0.100.12 from RForgelibrary(rayshader)
sessionInfo()
# R version 3.5.0 (2018-04-23)
# Platform: x86_64-w64-mingw32/x64 (64-bit)
# Running under: Windows 10 x64 (build 17763)
#
# Matrix products: default
#
# locale:
# [1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252 # LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
# [5] LC_TIME=English_Australia.1252
#
# attached base packages:
# [1] stats graphics grDevices utils datasets methods base
#
# other attached packages:
# [1] rayshader_0.9.1
#
# loaded via a namespace (and not attached):
# [1] Rcpp_1.0.0 later_0.7.3 imager_0.41.2 compiler_3.5.0 git2r_0.23.0 plyr_1.8.4
# [7] prettyunits_1.0.2 iterators_1.0.10 tools_3.5.0 progress_1.2.0.9000 digest_0.6.18 packrat_0.4.9-3
# [13] jsonlite_1.5 memoise_1.1.0 pkgconfig_2.0.2 png_0.1-7 rlang_0.3.1 foreach_1.4.4
# [19] igraph_1.2.2 shiny_1.2.0 rstudioapi_0.8 crosstalk_1.0.0 curl_3.2 parallel_3.5.0
# [25] xfun_0.2 readbitmap_0.1.5 bmp_0.3 knitr_1.21 withr_2.1.2 httr_1.3.1
# [31] stringr_1.3.1 htmlwidgets_1.2 devtools_1.13.6 hms_0.4.2 webshot_0.5.0 manipulateWidget_0.10.0
# [37] R6_2.3.0 jpeg_0.1-8 rgl_0.100.12 purrr_0.2.5 magrittr_1.5 promises_1.0.1
# [43] codetools_0.2-15 htmltools_0.3.6 assertthat_0.2.0 xtable_1.8-2 mime_0.5 httpuv_1.4.4.1
# [49] tiff_0.1-5 miniUI_0.1.1.1 stringi_1.2.4 doParallel_1.0.14 crayon_1.3.4
montshadow = ray_shade(montereybay,zscale=50,lambert=FALSE)
montamb = ambient_shade(montereybay,zscale=50)
montereybay %>%
sphere_shade(zscale=10,texture = "imhof1") %>%
add_shadow(montshadow,0.5) %>%
add_shadow(montamb) %>%
plot_3d(montereybay,zscale=50,fov=0,theta=-100,phi=30,windowsize=c(1000,800),zoom=0.6,
water=TRUE, waterdepth = 0, waterlinecolor = "white", waterlinealpha = 0.5,
wateralpha = 0.5,watercolor = "lightblue")
# Warning messages:
# 1: In rgl.material(...) : RGL: Pixmap load: file format unsupported
# 2: In rgl.material(...) : RGL: Pixmap load: failed
# 3: In rgl.material(...) : RGL: Pixmap load: file format unsupported
# 4: In rgl.material(...) : RGL: Pixmap load: failed
render_label(montereybay,x=350,y=240, z=4000,zscale=50,
text = "Moss Landing",textsize = 2,linewidth = 5)
# Error in rgl.texts(x = 350, y = 80.1314579963684, z = -240, text = "Moss Landing", :
# FreeType not supported in this build
It looks like this might be due to a missing "zlib" library on your machine, which is required for png support. When you compile rgl from source, do you see this error:
checking for zlib...no libpng requires zlib, so not installed. freetype requires zlib, so not installed.
From this stack overflow post: https://stackoverflow.com/questions/37823863/doesnt-work-legend3d-function-in-the-newest-version-of-the-rgl-package/37847419
Any update on this?
Sorry for the delay, Tyler. It seems like that's the case:
install.packages("rgl", repos = "http://R-Forge.R-project.org", type = "source")
# Installing package into ‘C:/Users/rensa/Documents/R/win-library/3.5’
# (as ‘lib’ is unspecified)
# trying URL 'http://R-Forge.R-project.org/src/contrib/rgl_0.100.15.tar.gz'
# Content type 'application/x-gzip' length 2867728 bytes (2.7 MB)
# downloaded 2.7 MB
#
# * installing *source* package 'rgl' ...
# configure.win32...
# checking for zlib...no
# libpng requires zlib, so not installed.
# freetype requires zlib, so not installed.
Trying to follow the SO answer, but in C:\Program Files\R\R-3.5.0\etc\x64\Makefile
, LOCAL_SOFT
is commented out, so I'm not sure where I should be putting zlib (and precisely which file zlib is in the attached link: is it lib/x64/libz.a
?).
I'm a little out of my depth here, unfortunately!
Try installing with the link here (Description says complete package):
http://gnuwin32.sourceforge.net/packages/zlib.htm
I’m going to close this issue since we know the reason, but you can continue commenting if you need any assistance.
Thanks very much, Tyler. Will the Zlib for Windows installer be okay? Its latest version is 12 years old (contrast the 1 year old version on zlib.net). Should I be learning to compile and install these dependencies on Windows more generally if I'm doing a lot of this?
Only one way to find out if it will work! (Try it and see)
In general it’s a good skill to have, but 99.99% of the time you will be able to work with pre-existing binaries or installers, so unless you need something truly cutting edge you don’t normally need to worry about it.
Thanks for the advice! It might take a couple of weeks for me to swing back and try this (submitting my thesis before the end of the month), but I'll let you know if I hit any problems 🙂
Good luck!
Hi, I'm also having a similar problem trying to install the zlib. I've completed all of the above steps, but RGL still loads with
checking for zlib...no
libpng requires zlib, so not installed
Any more detailed would really be appreciated!
Hi,
I don't know if @rensa managed to test the proposed solution, but unfortunately I didn't managed to install rayshadder on windows... I don't know where to copy the zlib dll so that is is found when installing rgl. rgl is working well by its own btw.
It @tylermorganwall has some new thoughts about it I would be glad to have some tips !
Just been having the same issue, tried all proposed steps including the install of the Zlib from GNU32. Haven't had any luck resolving the pixmap load failure.
I run into the same issues trying to install rayshader with FreeType on Windows. I didn't manage to solve the issues, but I think I made some progress towards a solution.
As mentioned above, rgl
should be installed from source. For this, install.packages
needs to find 1) Zlib, 2) libpng, and 3) freetype. Here we can see where rgl
searches for this files:
1) Zlib:
I didn't install Zlib from GNU32. Instead, I created the directory "src/extra/zlib" in my R installation path. Then I downloaded libz.a
from here and copied it into this directory. This leads to checking for zlib...yes
when trying to install rgl
from source.
2) libpng
This was similar to Zlib: I downloaded "libpng.a" from here and then copied it to "src/gnuwin32/bitmap/libpng". This leads to checking for libpng...yes
3) freetype
I downloaded this file. Make sure to select a destination without spaces in the directory name or else rgl
will throw an error. I installed it to "c:/GnuWin32". Then, I created an environmental variable "LIB_FREETYPE" and set it to "c:/GnuWin32". This leads to checking for freetype...yes, LIB_FREETYPE=C:\GnuWin32
when trying to install rgl
from source.
However, a couple of commands later, install.packages
fails with this error:
`ext/ftgl/FTGL/ftgl.h:32:22: fatal error: ft2build.h: No such file or directory
^
compilation terminated.`
I'll leave it there for the moment, because I run out of ideas and patience. :)
I got it working a few days ago by fully uninstalling rgl and getting the binaries from the CRAN site. Previously it just didn't seem to be replacing it properly and I had assumed it was actually installing. For some reason the screenshots it produces are of a weirdly low quality but it renders correctly and I can 3D plot ggplots
As mentioned above,
rgl
should be installed from source. For this,install.packages
needs to find 1) Zlib, 2) libpng, and 3) freetype.
I have succesfully followed the instructions to install these files so that when I run:
install.packages("rgl", repos = "http://R-Forge.R-project.org", type = "source")
,
it returns:
* installing *source* package 'rgl' ...
configure.win32...
checking for zlib...yes
checking for libpng...yes
checking for freetype...yes, LIB_FREETYPE=C:\GnuWin32
however the following content of that statement includes:
cp: cannot stat 'C:\GnuWin32/bin/x64/freetype6.dll': No such file or directory
why is that a backwards slash in the path? I even set 'C:/GnuWin32' as environment variable.
cp: -r not specified; omitting directory 'D:/Mijn'
R Packages are by default installed in my Documents folder, the path for rgl
is:
'D:\Mijn Documenten\R\win-library\3.5\rgl', is there an issue with that space? How do I solve that?
Note: freetype may require zlib1.dll
rm: cannot remove 'src/Makevars': No such file or directory
I created the 'src' directory myself as per dk-forestry's instructions: 'C:\Program Files\R\R-3.5.3\src\extra',
I did not create a Makevars directory.
** libs
Warning: this package has a non-empty 'configure.win' file,
so building only the main architecture
Finally it fails to compile rgl
It's taken me ages to get this far but it seems that new errors keep popping up, I'm very close to pulling out my hair.
I got this issue tonight after updating Windows and 3 weeks worth of R packages (not sure which was the cause).
Downloading http://gnuwin32.sourceforge.net/packages/zlib.htm, uninstalling rgl
and then installing the binary option of rgl
from CRAN fixed it.
@tylermorganwall : Your advice to install rgl
from R-forge was correct when you wrote it, but rgl
has moved to Github, so to get the latest version now, you should run
remotes::install_github("dmurdoch/rgl")
When I ran the
render_label()
example on the home page of the docs, I initially got an error unless I setfreetype = FALSE
:The docs don't currently talk about how to enable FreeType support, but fishing around in this thread I guessed that I'd need to install the external dependency and then reinstall
rgl
from source.I found and installed FreeType for Windows (hoping I have the right version!),as I'm on Windows 10, and then I reinstalled the
rgl
package from source (`install.packages('rgl', type = 'source')), which finished without error.However, the same example now isn't rendering properly, even without the labels:
I might need to get rid of FreeType for Windows and strip
rgl
andrayshader
to try again, but I was hoping you could update the docs to talk a bit more about enabling FreeType support 🙂I'm using on R 3.5.0 on Windows 10 Pro 1809, along with rayshader 0.9.0 and rgl 0.99.16 (after reinstalling from source—not the version originally installed with rayshader).
Thanks!