Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
multitouch
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
multitouch
Commits
d0ffb5c1
Commit
d0ffb5c1
authored
May 18, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sterted integration of MultitouchServer with VTK.
parent
0a8bc7fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
0 deletions
+74
-0
src/MultitouchInteractor.py
src/MultitouchInteractor.py
+74
-0
No files found.
src/MultitouchInteractor.py
0 → 100644
View file @
d0ffb5c1
import
vtk
from
threading
import
Thread
from
objreader
import
read_obj
from
touch
import
MultitouchServer
class
MultitouchInteractor
():
def
__init__
(
self
):
self
.
iren
=
vtk
.
vtkRenderWindowInteractor
()
self
.
touch_server
=
MultitouchServer
(
verbose
=
1
,
tuio_verbose
=
1
)
self
.
touch_server
.
bind
(
'rotate'
,
self
.
on_rotate
)
self
.
touch_server
.
bind
(
'pinch'
,
self
.
on_pinch
)
self
.
touch_server
.
bind
(
'tap'
,
self
.
on_tap
)
def
SetRenderWindow
(
self
,
window
):
self
.
iren
.
SetRenderWindow
(
window
)
self
.
window
=
window
def
Initialize
(
self
):
self
.
iren
.
Initialize
()
def
Start
(
self
):
#self.iren.Start()
#t = Thread(target=self.iren.Start)
#t.daemon = True
#t.start()
self
.
touch_server
.
start
(
threaded
=
True
,
daemon
=
True
)
try
:
import
time
while
True
:
self
.
window
.
Render
()
time
.
sleep
(
1.
/
60
)
except
KeyboardInterrupt
:
return
def
SetCamera
(
self
,
camera
):
self
.
camera
=
camera
def
on_rotate
(
self
,
event
):
self
.
camera
.
Roll
(
event
.
angle
)
def
on_pinch
(
self
,
event
):
pass
def
on_tap
(
self
,
event
):
print
'tap:'
,
event
if
__name__
==
'__main__'
:
# Create render window and interactor
ren
=
vtk
.
vtkRenderer
()
win
=
vtk
.
vtkRenderWindow
()
win
.
AddRenderer
(
ren
)
mt
=
MultitouchInteractor
()
mt
.
SetRenderWindow
(
win
)
# Read OBJ file
cubemapper
=
read_obj
(
'cube.obj'
)
# Create actor
cubeactor
=
vtk
.
vtkActor
()
cubeactor
.
SetMapper
(
cubemapper
)
ren
.
AddActor
(
cubeactor
)
mt
.
Initialize
()
mt
.
SetCamera
(
ren
.
GetActiveCamera
())
win
.
Render
()
mt
.
Start
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment