From bec688e5059364ea46a5959e74ac2d38896fbb37 Mon Sep 17 00:00:00 2001 From: SimonDanisch Date: Tue, 7 Mar 2017 14:16:20 +0100 Subject: [PATCH 1/5] include badges --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6724dfe..74f7b3e 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,16 @@ +Build status (Linux x86-64): +[![Build Status](https://ci.maleadt.net/buildbot/julia/png?builder=GLVisualize.jl:%20Julia%200.5%20(x86-64))](https://ci.maleadt.net/buildbot/julia/builders/GLVisualize.jl%3A%20Julia%200.5%20%28x86-64%29) + +[![Coverage Status](https://coveralls.io/repos/github/JuliaGL/GLVisualize.jl/badge.svg?branch=HEAD)](https://coveralls.io/github/JuliaGL/GLVisualize.jl?branch=HEAD) + + # GLVisualize GLVisualize is an interactive 2D/3D visualization library completely written in OpenGL and Julia. Its focus is on performance and allowing to display animations/interactions as smooth as possible. #### Installation of GLVisualize -You need OpenGL 3.3, which should be available on most computers nowadays. +You need OpenGL 3.3, which should be available on most computers nowadays. If you get an error like [this](https://github.com/JuliaGL/GLVisualize.jl/issues/129), please try updating your system/video driver. Please run: @@ -13,7 +19,7 @@ Pkg.add("GLVisualize") Pkg.test("GLVisualize") ``` -Running the tests will walk you through all examples. +Running the tests will walk you through all examples. I made a recording of me giving a descriptions for every example: [![glvisualize_tests](https://cloud.githubusercontent.com/assets/1010467/20456657/234e63dc-ae7b-11e6-9beb-fe49ea064aa8.png)](https://www.youtube.com/watch?v=WYX31vIkrd4&t=6s) @@ -60,7 +66,7 @@ Note that the CPU version takes around 60 seconds for every iteration. GPU accel # Documentation -Please visit [glvisualize.com](http://www.glvisualize.com/) . +Please visit [glvisualize.com](http://www.glvisualize.com/) . Example code on the website is out of date, pleaser refer to [examples folder](https://github.com/JuliaGL/GLVisualize.jl/tree/master/examples) to get the newest versions. From 0b98e1443164fb6c3e540fa651612c1edd1b23ea Mon Sep 17 00:00:00 2001 From: SimonDanisch Date: Tue, 7 Mar 2017 14:24:11 +0100 Subject: [PATCH 2/5] remove unused video function --- src/videotool.jl | 67 ++++++++---------------------------------------- 1 file changed, 10 insertions(+), 57 deletions(-) diff --git a/src/videotool.jl b/src/videotool.jl index 0282a8d..eddd774 100644 --- a/src/videotool.jl +++ b/src/videotool.jl @@ -1,63 +1,10 @@ -""" -Takes `frames`, which is supposed to be an array of images, -saves them as png's at path and then creates an webm video -from that with the name `name` -""" -function create_video(frames::Vector, name, screencap_folder, resample_steps=0, remove_destination=true) - println("saving frames for $name") - cd(screencap_folder) - mktempdir() do path - frame1 = first(frames) - for i=1:resample_steps - frame1 = Images.restrict(frame1) - end - resolution = size(frame1) - for (i,frame) in enumerate(frames) - resampled = frame - for x=1:resample_steps - resampled = Images.restrict(resampled) - end - frame = map(RGB{N0f8}, resampled) - save(joinpath(path, "$name$i.png"), frame, true) - end - len = length(frames) - frames = [] # free frames... - oldpath = pwd() - cd(path) - mktemp(path) do io, path - # output stdout to tmpfile , since there is too much going on with it - run(pipeline( - `png2yuv -I p -f 30 -b 1 -n $len -j $name%d.png`, - stdout="$(name).yuv",stdin=io, stderr=io - )) - run(pipeline( - `vpxenc --good --cpu-used=0 - --auto-alt-ref=1 --lag-in-frames=16 --end-usage=vbr - --passes=1 --threads=4 --target-bitrate=3500 - -o $(name).webm $(name).yuv`, - stdout=io, stdin=io, stderr=io - )) - end - targetpath = abspath(joinpath(screencap_folder, "$(name).webm")) - sourcepath = abspath("$(name).webm") - mv(sourcepath, targetpath, remove_destination=remove_destination) - cd(oldpath) - end -end - -function create_video(frame, name, path, resample_steps = 0) - println("saving static image for $name") - targetpath = abspath(joinpath(path, "$(name).png")) - for i=1:resample_steps - frame = Images.restrict(frame) - end - save(targetpath, frame, true) -end -#downsample #`ffmpeg -i volume.webm -codec:v libvpx -quality good -cpu-used 0 -b:v 500k -qmin 10 -qmax 42 -maxrate 500k -bufsize 1000k -threads 4 -vf scale=-1:480 -codec:a libvorbis -b:a 128k volume2.webm` # ffmpeg version # ffmpeg -r 24 -pattern_type glob -i '*.png' -vcodec libx264 -crf 25 -pix_fmt yuv420p test.mp4 - +""" +returns a stream and a buffer that you can use to not allocate for new frames. +Use `add_frame!(stream, window, buffer)` to add new video frames to the stream. +""" function create_video_stream(path, window) #codec = `-codec:v libvpx -quality good -cpu-used 0 -b:v 500k -qmin 10 -qmax 42 -maxrate 500k -bufsize 1000k -threads 8` tex = GLWindow.framebuffer(window).color @@ -66,12 +13,18 @@ function create_video_stream(path, window) io, Array(RGB{N0f8}, res) # tmp buffer end +""" +Adds a video frame to a stream created with `create_video_stream` +""" function add_frame!(io, window, buffer) #codec = `-codec:v libvpx -quality good -cpu-used 0 -b:v 500k -qmin 10 -qmax 42 -maxrate 500k -bufsize 1000k -threads 8` tex = GLWindow.framebuffer(window).color write(io, map(RGB{N0f8}, gpu_data(tex))) end +""" +Converts a folder full of videos into a folder full of webm videos +""" function webm_batchconvert(oldpath, newpath, scale = 0.5) for file in readdir(oldpath) isfile(file) || continue From b8bd3be9e7752cf3aee8b58a2f4a4bc7a8a0b85d Mon Sep 17 00:00:00 2001 From: SimonDanisch Date: Tue, 7 Mar 2017 14:24:32 +0100 Subject: [PATCH 3/5] add an example for using the documenation: --- examples/documentation/documentation.jl | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 examples/documentation/documentation.jl diff --git a/examples/documentation/documentation.jl b/examples/documentation/documentation.jl new file mode 100644 index 0000000..475574a --- /dev/null +++ b/examples/documentation/documentation.jl @@ -0,0 +1,9 @@ +using GLVisualize + +# prints the documenation of parameters for visualizing a float matrix +get_docs(rand(Float32, 32, 32)) +# prints the documenation of parameters for visualizing a float matrix in surface style +get_docs(rand(Float32, 32, 32), :surface) + +# prints all visualization methods available with some documenation if available +all_docs() From 19a7906474b12ecb7461f4c2bf746e7183bff36f Mon Sep 17 00:00:00 2001 From: SimonDanisch Date: Tue, 7 Mar 2017 15:10:24 +0100 Subject: [PATCH 4/5] test for new coverage change --- test/runtests.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index f6b1fcd..4b6a81a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -10,6 +10,10 @@ if isheadless() run(`git fetch origin`) run(`git checkout sd/warn`) end + cd(Pkg.dir("GLAbstraction")) do + run(`git fetch origin`) + run(`git checkout sd/linenumbers`) + end include("test_static.jl") else include("test_interactive.jl") From a56882ff54176b6379f16efabfb69280b88e0836 Mon Sep 17 00:00:00 2001 From: SimonDanisch Date: Tue, 7 Mar 2017 15:16:15 +0100 Subject: [PATCH 5/5] remove unused --- src/text/richtext.jl | 80 -------------------------------------------- 1 file changed, 80 deletions(-) delete mode 100644 src/text/richtext.jl diff --git a/src/text/richtext.jl b/src/text/richtext.jl deleted file mode 100644 index ccd9569..0000000 --- a/src/text/richtext.jl +++ /dev/null @@ -1,80 +0,0 @@ -type Text - atlas - offsets - uvs - positions - colors - scales -end -length(rt::Text) = length(rt.text) -function sizehint!(t:Text, size::Int) - for elem in (:text, :positions, :colors, :scales, :uvs, :offsets) - sizehint!(getfield(t, elem), size) - end - nothing -end -const TextDefault = Dict( - :atlas => GLVisualize.get_texture_atlas() - :color => RGBA{Float32}(0,0,0,1) - :scale => Vec2f0(50) - :font => GLVisualize.defaultfont() -) - -type RichText - defaults::FixedKeyDict - text::Text - inlined_objects::Vector - links::Vector - cursor -end -function sizehint!(t:RichText, size::Int) - sizehint!(t.text, size) - nothing -end -length(rt::RichtText) = length(rt.text) -make_iter(x) = repeat(x) -make_iter(x::AbstractArray) = x - -function get_iter(defaultfunc, dictlike, key) - make_iter(get(defaultfunc, dictlike, key)) -end - -""" -Inserts text at [`position`] with `style` -""" -function insert!(text::RichText, text2::AbstractString, position=text.cursor, style=EMPTY_STYLE) - positions = get_iter(()->positions(text, text2), style, :positions) - offsets = get_iter(()->offsets(text, text2), style, :offsets) - colors = get_iter(()->font_color(text), style, :colors) - fonts = get_iter(()->font(text), style, :fonts) - sizes = get_iter(()->font_size(text), style, :fontsizes) - - for elem in zip(text2, positions, colors, fonts, sizes) - push!(text.text, elem) - end -end - -""" -Inserts code with highlighting -""" -function insert!(text::RichText, code::Code, - position=text.cursor, - color_scheme=color_scheme(text, code) - ) - -end - -""" -Inlines any `object` in `area` at `position`. -""" -function insert!(text::RichText, object, position=text.cursor, area=nothing) - -end - - -function push!(text::RichText, values::RichtTextValues) - for props in zip(text2, positions, colors, fonts, sizes) - push!(text, props) - end - nothing -end