- Timestamp:
- 05/17/11 14:54:07 (12 months ago)
- File:
-
- 1 edited
-
trunk/examples/video/video.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/video/video.py
r492 r569 30 30 import sys 31 31 import math 32 import avango 33 import avango.display 34 import sys 32 35 36 37 argv = avango.display.init(sys.argv) 38 view = avango.display.make_view() 39 view.EnableTrackball.value = True 40 41 #root_obj = avango.osg.nodes.MatrixTransform(Matrix=avango.osg.make_trans_mat(0,1.7,-1.2)) 42 #view.Root.value = root_obj 43 view.Root.value = avango.osg.nodes.Group() 44 45 sphere = avango.osg.nodes.Sphere(Radius=0.1) 46 47 #avango.display.run() 48 49 """ 33 50 # set up scene graph 34 51 root_group = avango.osg.nodes.Group() … … 50 67 window.DragEvent.connect_from(events.DragEvent) 51 68 window.MoveEvent.connect_from(events.MoveEvent) 69 """ 52 70 53 71 # load a video 54 72 loadimagestream = avango.osg.nodes.LoadImageStream( 55 73 Filename = sys.argv[1]) 56 viewer.frame() 74 #viewer.frame() 75 avango.evaluate() 57 76 58 77 video = loadimagestream.ImageStream.get_value() … … 61 80 62 81 videoTexture = avango.osg.nodes.Texture2D(Image = video, ResizeNonPowerOfTwoHint = False) 63 ss = avango.osg.nodes.StateSet(Texture0 = videoTexture) 64 obj = avango.osg.nodes.Sphere(Name="TexturedSphere", StateSet = ss) 82 #s = avango.osg.nodes.StateSet(Texture0 = videoTexture) 65 83 66 root_group.Children.value = [obj] 84 85 print videoTexture.Image.value.Width.value 86 print videoTexture.TextureHeight.value 87 88 89 quad = avango.osg.nodes.TexturedQuad() 90 quad.Texture2D.value = videoTexture 91 quad.UseFilename.value = False 92 93 geode = avango.osg.nodes.Geode(Drawables = [quad]) 94 95 #obj = avango.osg.nodes.Sphere(Name="TexturedSphere", StateSet = ss) 96 97 view.Root.value.Children.value.append(geode) 98 #view.Root.value.Children.value.append(sphere) 99 #root_group.Children.value = [quad] 67 100 68 101 # render a frame to update bounding spheres and scale model to fit in window 69 viewer.frame()70 scale = 0.08 / obj.get_bounding_sphere().radius()102 #viewer.frame() 103 #scale = 0.08 / obj.get_bounding_sphere().radius() 71 104 72 obj.Matrix.value = \73 avango.osg.make_rot_mat(math.radians(90), 1,0,0) * \74 avango.osg.make_rot_mat(math.radians(90), 0,1,0) * \75 avango.osg.make_trans_mat(0,0,-5) * \76 avango.osg.make_scale_mat(scale,scale,scale)105 #obj.Matrix.value = \ 106 # avango.osg.make_rot_mat(math.radians(90), 1,0,0) * \ 107 # avango.osg.make_rot_mat(math.radians(90), 0,1,0) * \ 108 # avango.osg.make_trans_mat(0,0,-5) * \ 109 # avango.osg.make_scale_mat(scale,scale,scale) 77 110 78 viewer.run() 111 #viewer.run() 112 avango.display.run()
Note: See TracChangeset
for help on using the changeset viewer.
