Skip to content

Instantly share code, notes, and snippets.

@ufechner7
Created January 14, 2017 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ufechner7/8559c4fe9c7e4b0ec0b858090684d5e5 to your computer and use it in GitHub Desktop.
Save ufechner7/8559c4fe9c7e4b0ec0b858090684d5e5 to your computer and use it in GitHub Desktop.
GLVisualize example
using GLVisualize, GeometryTypes, Colors
using Reactive, GLAbstraction
window = glscreen()
timesignal = loop(linspace(0f0, 1f0, 360))
large_sphere = HyperSphere(Point3f0(0), 1f0)
rotation_angle = const_lift(*, timesignal, 2f0*pi)
rotation = map(rotationmatrix_z, rotation_angle)
positions = decompose(Point3f0, large_sphere)
indices = rand(range(Cuint(0), Cuint(length(positions))), 1000)
color = map(large_sphere->RGBA{Float32}(large_sphere, 0.9f0), colormap("Blues", length(positions)))
color2 = map(large_sphere->RGBA{Float32}(large_sphere, 1f0), colormap("Blues", length(positions)))
lines = visualize(
positions, :linesegment, thickness=0.5f0,
color=color, indices=indices, model=rotation
)
spheres = visualize(
(Sphere{Float32}(Point3f0(0.0), 1f0), positions),
color=color2, scale=Vec3f0(0.05), model=rotation
)
view(lines, window, camera=:perspective)
view(spheres, window, camera=:perspective)
renderloop(window)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment