bwlewis / rthreejs

Three.js widgets for R and shiny
http://bwlewis.github.io/rthreejs
Other
303 stars 64 forks source link

Shader errors on some platforms (was: warning message when using graphjs) #59

Open jzicker opened 7 years ago

jzicker commented 7 years ago

attempting example of graphjs and get this warning

g <- graphjs(LeMis, main="Les Misérables", showLabels=TRUE) print(g) Warning message: In structure(x, class = unique(c("AsIs", oldClass(x)))) : Calling 'structure(NULL, )' is deprecated, as NULL cannot have attributes. Consider 'structure(list(), )' instead.

This was for previous version of threejs. I installed 0.3 and now the viewer in RStudio shows nothing. I tried the same in R and got the same results in the browser

bwlewis commented 7 years ago

This is working for me with the latest master branch and R version in both command line R and RStudio (details below).

library(threejs)
data(LeMis)
g <- graphjs(LeMis, main="Les Misérables", showLabels=TRUE)
print(g)

R.version
## ... R version 3.4.0 (2017-04-21)

packageDescription("threejs")
## ...
## Version: 0.3.0
## GithubRepo: rthreejs
## GithubUsername: bwlewis
## GithubRef: master
## GithubSHA1: 6d7c9aaddb02d0010b864adb4398d64c7a1fc591

Can you provide details on R.version and threejs version? Thanks.

jzicker commented 7 years ago

Thanks for looking into this. I was running a previous version of threejs. I changed to version 0.3.0 and it now completes but shows no graph in the RStudio window. I'm guessing it is my environment but struggling to debug what is wrong. here are the versions I am running

R.version _
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 4.0
year 2017
month 04
day 21
svn rev 72570
language R
version.string R version 3.4.0 (2017-04-21)

packageDescription("threejs") Package: threejs Type: Package Title: Interactive 3D Scatter Plots, Networks and Globes Description: Create interactive 3D scatter plots, network plots, and globes using the 'three.js' visualization library ("http://threejs.org"). Version: 0.3.0 Date: 2017-04-26 Authors@R: c( person("B. W.", "Lewis", role=c("aut","cre"), email="blewis@illposed.net"), person(given="Three.js authors", role="cph", comment="three.js JavaScript library"), person("Alexey", "Stukalov", role=("ctb"), email="astukalov@gmail.com"), person("Yihui","Xie", role=("ctb"), email="xie@yihui.name"), person("Andreas", "Briese", role=("ctb"), email="ab@edutoolbox.de"), person("B.", "Thieurmel", role=("ctb"), email="bthieurmel@gmail.com") ) URL: http://bwlewis.github.io/rthreejs BugReports: https://github.com/bwlewis/rthreejs/issues License: MIT + file LICENSE Depends: R (>= 3.0.0), igraph (>= 1.0.0) Imports: htmlwidgets (>= 0.3.2), base64enc, stats Suggests: htmltools (>= 0.2.6), maps Enhances: knitr, shiny RoxygenNote: 6.0.1 Author: B. W. Lewis [aut, cre], Three.js authors [cph] (three.js JavaScript library), Alexey Stukalov [ctb], Yihui Xie [ctb], Andreas Briese [ctb], B. Thieurmel [ctb] Maintainer: B. W. Lewis blewis@illposed.net Built: R 3.4.0; ; 2017-05-24 12:50:45 UTC; windows RemoteType: github RemoteHost: https://api.github.com RemoteRepo: rthreejs RemoteUsername: bwlewis RemoteRef: master RemoteSha: 6d7c9aaddb02d0010b864adb4398d64c7a1fc591 GithubRepo: rthreejs GithubUsername: bwlewis GithubRef: master GithubSHA1: 6d7c9aaddb02d0010b864adb4398d64c7a1fc591

bwlewis commented 7 years ago

OK, I can replicate this on Windows, thanks. Working on a fix...

bwlewis commented 7 years ago

Ugh. Found the problem. I'm using EcmaScript 6 and in particular the spread operator (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe erence/Operators/Spread_operator) which apparently is not supported by RStudio yet on all platforms (it seems to work for me on Linux!). (See, for instance, https://github.com/bwlewis/rthreejs/blob/master/inst/htmlwidgets/scatterplotThree.js#L439 and elsewhere in the code).

@jjallaire you may find this bug interesting!

Working on re-writing this now...

bwlewis commented 7 years ago

I see another serious problem rendering on RStudio on Windows--I'm getting GLSL shader errors like:

THREE.WebGLShader: gl.getShaderInfoLog() vertex WARNING: 0:2: '' :  #version directive missing
ERROR: 0:60: 'const' : overloaded functions must have the same parameter qualifiers 

This might be one of those dumb OpenGL/DirectX problems in Windows. Working on that...

jzicker commented 7 years ago

Wow. Thanks for putting all the effort in on this. I'm looking forward to showing my colleagues (network medicine project) a network visualization using threejs. I'll make sure to mention your efforts

bwlewis commented 7 years ago

Also, if you "pop out" the plot into a browser window (with the little "show in new window" button) it should work. The issue is inside the WebGL interface in RStudio.

jzicker commented 7 years ago

pop out did work! Awesome. I was using zoom from RStudio which of course gave the same blank screen. I can make progress with that as a work around for now.

bwlewis commented 7 years ago

These shader errors only occur in RStudio as far as I can tell.

@jjallaire or @ramnathv if you know someone interested in helping on this, let me know.

Things (mostly) work in RStudio on Linux:

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/538.1 (KHTML, like Gecko) RStudio Safari/538.1 Qt/5.4.0

but not at all on Windows:

Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/538.1 (KHTML, like Gecko) rstudio Safari/538.1 Qt/5.4.1
jjallaire commented 7 years ago

I don't offhand.

We're hoping to update our version of QtWebKit but we are waiting on Qt 5.9 (or perhaps 5.10). Should be around the end of this year.

jzicker commented 7 years ago

a little more information. pop out works when default browser is chrome. when default browser is microsoft edge same blank page as in RStudio viewer.

bwlewis commented 7 years ago

ok, curious--it works for me with edge on win 10.

i am backing through threejs versions tonight to see if that will fix it.

On May 24, 2017 4:48 PM, "jzicker" notifications@github.com wrote:

a little more information. pop out works when default browser is chrome. when default browser is microsoft edge same blank page as in RStudio viewer.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bwlewis/rthreejs/issues/59#issuecomment-303847344, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIsnm4Vwa4pdmZPUACJYT_EORZ9YHybks5r9JeqgaJpZM4Ngh_a .

bwlewis commented 7 years ago

I can't fix this--errors are happening with even default threejs shaders. The issues are in the various implementations of WebGL used by the target. For instance the QtWebKit version used by RStudio right now on Windows will not work. Thus, RStudio on Windows won't be supported directly until that is updated.

The work around for now is to pop out the plot, or perhaps better, to run RStudio server instead of the desktop application.

I will leave this open with a "help wanted" tag in case someone with more WebGL knowledge than me can fix!