Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3d plotting with Julia, OpenGL bindings #418

Closed
rodrigob opened this issue Feb 20, 2012 · 17 comments
Closed

3d plotting with Julia, OpenGL bindings #418

rodrigob opened this issue Feb 20, 2012 · 17 comments
Labels
help wanted Indicates that a maintainer wants help on an issue or pull request

Comments

@rodrigob
Copy link

Julia has kick ass features for computation.
However what is the point of computing so much if the data cannot be visualized/inspected ?

Current 2d plotting capabilities are nice, but no real matlab/scilab/scipy competitor would be credible without some kind of 3d plotting.

One way of going would be to "port" mayavi to Julia.
http://github.enthought.com/mayavi/mayavi/auto/examples.html

Mayavi builds on top of VTK, so the 3d system itself would not be reinvented from scratch.

I think this would be relevant feature to have for release 2.0...

ps: 2d or 3d plotting systems in Julia should have SVG/PDF output, so it can be used in scientific publishing...

@ViralBShah
Copy link
Member

Yes, agree on both fronts that plotting is needed, and it needs to be publishable quality. SVG/PDF output is also a must. Is there anything serious for 3d plotting in the browser?

@rodrigob
Copy link
Author

There some quite good 3d javascript engines, but I have seen/found nothing "that does not look that a weekend hack" for 3d plotting.

Examples of not so great 3d plotting in javascript:

Examples of great 3d engines:

When looking at the Mayavi examples I realize that writting a "good" 3d plotting seems quite a large task,
thus the idea of reusing an existing code base (VTK). I understand that this breaks the "let us use the browser as the interface" idea...

@JeffBezanson
Copy link
Member

It seems possible in theory to have multiple graphical interfaces, but quite difficult for them not to work against each other.

@rodrigob
Copy link
Author

I agree... however there are some design issues I fail to see solved in the "let us use a separate web browser" path.
For instance, how do you avoid duplicating the data in the Julia side and in the browser side ?
How would you plot a very large dataset (let us say, a 2Gb matrix) ?

When moving to 3d, the data volume grows significantly compared to simple 1d plots...

@ViralBShah
Copy link
Member

Yes, that is a fair point. Although, at any given point, you are only displaying an image on the screen - so one could be intelligent about it.

@rodrigob
Copy link
Author

Yes, of course. An "advanced" plotter, will request data as needed. So, at the very least, you need bi-directional communication so the plot thread/process can read the data on an "as needed" basis.
I am not saying that the javascript way is not doable, it is; I am just pointing out that is a lot of work, and a lot of "julia specific" work (because most existing web plotting software will just assume that all javascript data fits in memory).

I am not an VTK expert, but I would expect VTK to handle this "the right way". Anyone has experience with Mayavi/Vtk ? (with respect to memory management when handling large datasets ?)

@ViralBShah
Copy link
Member

Yes - there is no doubt that this would be orders of magnitude easier to do using Mayavi/VTK. We need someone who knows this stuff to start a project.

@ViralBShah
Copy link
Member

@nolta Can winston support 3d graphics? Would we use cairo for that, or want to directly do OpenGL, or use something different altogether like Mayavi/VTK?

On the browser side, this is an interesting experiment:
http://www-m10.ma.tum.de/bin/view/Lehrstuhl/SoftwareExperiments

@JeffBezanson
Copy link
Member

I once wrote a simple 3d graphing thing using cairo as a backend, but you basically just get depth-sorted polygons, no z-buffering, hardware acceleration, shading, etc. So we need something different; OpenGL bindings would be cool of course.

@nolta
Copy link
Member

nolta commented Mar 19, 2012

Winston is 2d only at the moment. It probably would be best to write a separate 3d plotting package, rather than add 3d to winston.

@rodrigob
Copy link
Author

For 3d plotting in the web repl, now google provides an interesting example

https://www.google.com/search?q=sqrt%28x*x%2By*y%29%2B3*cos%28sqrt%28x*x%2By*y%29%29%2B5+from+-20+to+20

@rodrigob
Copy link
Author

rodrigob commented May 5, 2012

Here is one more tool of interest for this issue. RGL, an OpenGL 3d renderer for R, which now has support to export towards WebGL

http://www.r-bloggers.com/r-interactive-3d-webgl-plot-of-time-space-cube-with-rgl/

http://rgl.neoscientists.org/gallery.shtml

@JeffBezanson
Copy link
Member

@o-jasper has created julia OpenGL bindings here: https://github.com/o-jasper/julia-ffi. This probably deserves to be better known.

@JeffBezanson
Copy link
Member

OpenGL package now available.

@vtjnash
Copy link
Member

vtjnash commented Feb 1, 2013

with the package system (and an OpenGL package available), what is still required to close this issue? (e.g. the title seems too broad to ever be included in "base" Julia)

@ihnorton
Copy link
Member

If anyone is still interested in VTK, I am working on bindings in pure Julia (for now..), using clang.jl and a few helper functions to call into the Clang C++ API for information that is not available via libclang.

https://github.com/ihnorton/VTK.jl

There is a ways to go, but it is reasonably far along now and I could use help with testing or development.. On linux at least, the code currently supports inheritance and automatic base class resolution, static functions (called by mangled name), as well as both member and virtual methods (dispatched on typed-pointer first argument, and parametric to allow calls against subtypes when not overloaded). There are very likely some "unknown-unknown" corner cases that I haven't hit yet... but in the worst case, I will resort to emitting C-exported wrapper code where necessary.

@JeffBezanson
Copy link
Member

Wow that is really clever! Using macros to directly generate the code for a virtual call is a nice bit of mad science.

StefanKarpinski pushed a commit that referenced this issue Feb 8, 2018
Compat.Base64
cmcaine pushed a commit to cmcaine/julia that referenced this issue Nov 11, 2022
ViralBShah pushed a commit that referenced this issue Aug 26, 2023
Stdlib: SparseArrays
URL: https://github.com/JuliaSparse/SparseArrays.jl.git
Stdlib branch: main
Julia branch: master
Old commit: 99c99b4
New commit: 54f4b39
Julia version: 1.11.0-DEV
SparseArrays version: 1.11.0
Bump invoked by: @ViralBShah
Powered by:
[BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl)

Diff:
JuliaSparse/SparseArrays.jl@99c99b4...54f4b39

```
$ git log --oneline 99c99b4..54f4b39
54f4b39 Fix docs conflict when building as part of full Julia docs (#430)
a64ef4f Cleanup reloaded (#426)
4e2d1e4 Respect `IOContext` while displaying a `SparseMatrixCSC` (#423)
3d1eda9 Test suite: activate a temp project if we need to install Aqua.jl during the test suite (#425)
18b7fce Merge pull request #422 from JuliaSparse/jn/cat
e2c78b8 test: restore ambiguous test
68afc6e fix inference of SparseVector cat
c402d09 cat: ensure vararg is more inferrable
2c4f870 Fix some broken links (#421)
36a5308 bump version (#418)
```

Co-authored-by: Dilum Aluthge <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Indicates that a maintainer wants help on an issue or pull request
Projects
None yet
Development

No branches or pull requests

6 participants