Skip to content

Commit 407497a

Browse files
committed
glvideo examples
1 parent bd05680 commit 407497a

32 files changed

+58
-0
lines changed
1.8 MB
Binary file not shown.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
load_library :glvideo
2+
3+
include_package 'gohai.glvideo'
4+
attr_reader :video
5+
6+
def settings
7+
size(320, 240, P2D)
8+
end
9+
10+
def setup
11+
sketch_title 'Simple Capture'
12+
report_config
13+
# this will use the first recognized camera by default
14+
@video = GLCapture.new(self)
15+
# you could be more specific also, e.g.
16+
# video = GLCapture.new(self, devices[0])
17+
# video = GLCapture.new(self, devices[0], 640, 480, 25)
18+
# video = GLCapture.new(self, devices[0], configs[0])
19+
video.play
20+
end
21+
22+
def draw
23+
background 0
24+
video.read if video.available
25+
image(video, 0, 0, width, height)
26+
end
27+
28+
def report_config
29+
devices = GLCapture.list
30+
puts('Devices:')
31+
devices.each { |dev| puts dev }
32+
if (0 < devices.length)
33+
configs = GLCapture.configs(devices[0]).to_a # ruby array
34+
puts('Configs:')
35+
configs.map { |cam| puts cam.strip }
36+
end
37+
end
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
load_library :glvideo
2+
3+
include_package 'gohai.glvideo'
4+
5+
attr_reader :video
6+
7+
def setup
8+
sketch_title 'Single Video'
9+
@video = GLMovie.new(self, data_path('launch1.mp4'))
10+
video.loop
11+
end
12+
13+
def draw
14+
background(0)
15+
video.read if video.available
16+
image(video, 0, 0, width, height)
17+
end
18+
19+
def settings
20+
size(560, 406, P2D)
21+
end
Binary file not shown.
1.39 MB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2.86 MB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)