Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
multitouch
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
multitouch
Commits
09114642
Commit
09114642
authored
13 years ago
by
Taddeus Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Removed old framework test files.
parent
a70b530b
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
src/kivy_vtk_example.py
+0
-108
0 additions, 108 deletions
src/kivy_vtk_example.py
src/main.py
+0
-13
0 additions, 13 deletions
src/main.py
src/vtkkivy.py
+0
-91
0 additions, 91 deletions
src/vtkkivy.py
with
1 addition
and
212 deletions
.gitignore
+
1
−
0
View file @
09114642
...
...
@@ -11,3 +11,4 @@
*.nav
*.snm
main.bat
src/old/*
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/kivy_vtk_example.py
deleted
100755 → 0
+
0
−
108
View file @
a70b530b
#!/usr/bin/env python
from
kivy.uix.widget
import
Widget
from
kivy.app
import
App
from
kivy.clock
import
Clock
,
ClockBase
from
kivy.graphics
import
Color
,
Rectangle
,
Callback
,
Fbo
from
vtk
import
*
from
OpenGL.GL
import
*
from
OpenGL.GLU
import
*
# set the environment so that special renderer is used by vtk
import
os
os
.
environ
[
'
VTK_RENDERER
'
]
=
'
EmbedOpenGL
'
cone
=
vtkConeSource
()
mapper
=
vtkPolyDataMapper
()
actor
=
vtkActor
()
ren
=
vtkRenderer
()
renWin
=
vtkRenderWindow
()
mapper
.
SetInput
(
cone
.
GetOutput
())
actor
.
SetMapper
(
mapper
)
ren
.
AddActor
(
actor
)
ren
.
SetBackground
(
0.0
,
1.0
,
0.0
)
ren
.
GetActiveCamera
().
Dolly
(.
3
)
ren
.
GetActiveCamera
().
Azimuth
(.
5
)
renWin
.
AddRenderer
(
ren
)
renWin
.
SetSize
(
512
,
512
)
VTKClock
=
ClockBase
()
class
VTKWidget
(
Widget
):
def
__init__
(
self
,
**
kwargs
):
super
(
VTKWidget
,
self
).
__init__
(
**
kwargs
)
self
.
setupVTK
()
def
updateVTK
(
self
,
*
largs
):
self
.
fbo
.
ask_update
()
self
.
canvas
.
ask_update
()
def
setupVTK
(
self
):
Clock
.
schedule_interval
(
self
.
updateVTK
,
1
/
1.
)
with
self
.
canvas
:
self
.
fbo
=
Fbo
(
size
=
(
512
,
512
),
clear_color
=
(.
3
,
.
3
,
.
3
,
.
8
),
push_viewport
=
True
,
with_depthbuffer
=
True
)
self
.
size
=
self
.
fbo
.
size
Color
(
0
,
0
,
1
)
Rectangle
(
pos
=
self
.
pos
,
size
=
self
.
size
,
texture
=
self
.
fbo
.
texture
)
Callback
(
self
.
drawVTK
,
reset_context
=
True
)
def
drawVTK
(
self
,
instr
):
glEnable
(
GL_DEPTH_TEST
)
glEnable
(
GL_CULL_FACE
)
VTKClock
.
tick
()
#self.fbo.release()
#self.fbo.bind()
glViewport
(
0
,
0
,
512
,
512
)
self
.
fbo
.
clear_buffer
()
#push GL state of Kivy
glPushAttrib
(
GL_ALL_ATTRIB_BITS
)
glMatrixMode
(
GL_PROJECTION
)
glPushMatrix
()
glMatrixMode
(
GL_MODELVIEW
)
glPushMatrix
()
glLoadIdentity
()
renWin
.
Render
()
#pop previous state of Kivy
glMatrixMode
(
GL_MODELVIEW
)
glPopMatrix
()
glMatrixMode
(
GL_PROJECTION
)
glPopMatrix
()
glPopAttrib
()
self
.
fbo
.
release
()
class
MyVTKApp
(
App
):
def
build
(
self
):
return
VTKWidget
()
if
__name__
==
'
__main__
'
:
MyVTKApp
().
run
()
# glMatrixMode(GL_PROJECTION)
# glLoadIdentity()
# gluPerspective(45.0, 1.0, 0.01, 10000.0)
# glPushMatrix()
# glMatrixMode(GL_MODELVIEW)
# glLoadIdentity()
# glPushMatrix()
#
# #Load identity and render VTK
# gluLookAt(0.,0.,-1.,0.,0.,0.,0.,1.,0.)
#
# glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
# glEnable(GL_DEPTH_TEST)
#
# glColor4f(1.,0.,0.,1.)
# glBegin(GL_LINE_STRIP)
# glVertex3f(0.,0.,-100.)
# glVertex3f(100.,100.,100.)
# glEnd()
This diff is collapsed.
Click to expand it.
src/main.py
deleted
100755 → 0
+
0
−
13
View file @
a70b530b
#!/usr/bin/env python
import
kivy
kivy
.
require
(
'
1.0.6
'
)
# replace with your current kivy version !
from
kivy.app
import
App
from
kivy.uix.button
import
Button
class
MyApp
(
App
):
def
build
(
self
):
return
Button
(
text
=
'
Hello World
'
)
if
__name__
in
(
'
__android__
'
,
'
__main__
'
):
MyApp
().
run
()
This diff is collapsed.
Click to expand it.
src/vtkkivy.py
deleted
100755 → 0
+
0
−
91
View file @
a70b530b
#!/usr/bin/env python
import
vtk
from
kivy.uix.widget
import
Widget
from
kivy.app
import
App
from
kivy.clock
import
Clock
,
ClockBase
from
kivy.graphics
import
Fbo
,
Callback
,
Color
,
Rectangle
import
OpenGL.GL
as
gl
from
objreader
import
read_obj
#__all__ = ('vtk_clock', 'VtkWidget')
#import os
#os.environ['VTK_RENDERER'] = 'EmbedOpenGL'
vtk_clock
=
ClockBase
()
class
VtkWidget
(
Widget
):
def
__init__
(
self
,
size
=
(
512
,
512
),
**
kwargs
):
super
(
VtkWidget
,
self
).
__init__
(
**
kwargs
)
self
.
size
=
size
self
.
setup_vtk
()
def
setup_vtk
(
self
):
self
.
renderer
=
vtk
.
vtkRenderer
()
self
.
window
=
vtk
.
vtkRenderWindow
()
self
.
window
.
AddRenderer
(
self
.
renderer
)
self
.
window
.
Render
()
# Redraw 60 times per second
Clock
.
schedule_interval
(
self
.
update_vtk
,
1
/
60.
)
# Create a frame buffer that represents the VTK window
with
self
.
canvas
:
self
.
fbo
=
Fbo
(
size
=
self
.
size
)
Color
(
1
,
1
,
1
)
Rectangle
(
size
=
self
.
size
,
texture
=
self
.
fbo
.
texture
)
with
self
.
fbo
:
Callback
(
self
.
draw_vtk
,
reset_context
=
True
)
#self.fbo.bind()
def
update_vtk
(
self
,
instr
):
self
.
fbo
.
ask_update
()
self
.
canvas
.
ask_update
()
def
draw_vtk
(
self
,
instr
):
vtk_clock
.
tick
()
# Bind OpenGL context
#self.fbo.bind()
self
.
fbo
.
clear_buffer
()
gl
.
glEnable
(
gl
.
GL_DEPTH_TEST
)
gl
.
glEnable
(
gl
.
GL_CULL_FACE
)
# Redraw VTK window within the bound OpenGL context
self
.
window
.
Render
()
# Release OpenGL context
#self.fbo.release()
class
CubeWidget
(
VtkWidget
):
def
__init__
(
self
,
**
kwargs
):
super
(
CubeWidget
,
self
).
__init__
((
512
,
512
),
**
kwargs
)
self
.
add_cube
()
self
.
add_interactor
()
def
add_cube
(
self
):
cubemapper
=
read_obj
(
'
cube.obj
'
)
cubeactor
=
vtk
.
vtkActor
()
cubeactor
.
SetMapper
(
cubemapper
)
self
.
renderer
.
AddActor
(
cubeactor
)
def
add_interactor
(
self
):
iren
=
vtk
.
vtkRenderWindowInteractor
()
iren
.
SetRenderWindow
(
self
.
window
)
iren
.
Initialize
()
iren
.
Start
()
class
CubeApp
(
App
):
def
build
(
self
):
return
CubeWidget
()
if
__name__
==
'
__main__
'
:
CubeApp
().
run
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment