#1
|
|||
|
|||
Video Texturing
Hi, I'm new to the forums, I've been guided here by my lecturer at Uni. I'm trying to texture a box, but it doesn't seem to want to work properly. Here's the bit of my code that does the video...
Code:
import viz viz.go() viz.clearcolor(0.5,0.5,1) cinemas = viz.add('Thing.ive') Screen01 = cinemas.getchild('Screen01') Screen01Trailer = viz.addVideo('Trailer1.mpg') Screen01Trailer.rate(1) Screen01.texture(Screen01Trailer) global Trailer01Play Trailer01Play = 'FALSE' def mouseclick(button): global Trailer01Play print 'mouse clicked' if button == viz.MOUSEBUTTON_LEFT: pickObject = viz.pick() if pickObject.valid() and pickObject == Screen01 and Trailer01Play == 'FALSE': Screen01Trailer.play() Trailer01Play = 'TRUE' print 'Trailer 1 Playing' return() elif pickObject.valid() and pickObject == Screen01 and Trailer01Play == 'TRUE': Screen01Trailer.stop() Trailer01Play = 'FALSE' print 'Trailer 1 Stopped' return() viz.callback(viz.MOUSEDOWN_EVENT,mouseclick) Thanks in advance for any help you can give!... P.S. While I'm here too, another problem I'm having is, is it possible to have a GUI that has buttons (in this case arrows) that can be held down and have a constant action. Basically, I'm making this thing as if it can go on a touch screen, and I want to be able to hold down on the up arrow on the GUI and it will move forward for as long as you hold it down, as opposed to how it's doing it now, with it having to be pressed lots of times to move forward. |
#2
|
|||
|
|||
Does the video show up fine when you apply it to a texture quad, like in the following example?
Code:
import viz viz.go() video = viz.add('Trailer1.mpg') video.play() viz.addTexQuad(texture=video,pos=(0,1.8,2)) Also, here is an example that shows how to perform functions while a button is pressed: Code:
import viz viz.go() viz.add('gallery.ive') #Add buttons for turning viewpoint left/right lbutton = viz.addButtonLabel('Turn Left',pos=(0.4,0.1,0)) rbutton = viz.addButtonLabel('Turn Right',pos=(0.6,0.1,0)) #Setup timers for turning viewpoint TURN_SPEED = 90.0 def TurnView(speed): viz.MainView.setEuler(speed*viz.elapsed(),0,0,viz.HEAD_ORI,viz.REL_LOCAL) turnLeftTimer = vizact.ontimer(0,TurnView,-TURN_SPEED) turnRightTimer = vizact.ontimer(0,TurnView,TURN_SPEED) #Disable timers initially turnLeftTimer.setEnabled(False) turnRightTimer.setEnabled(False) #Enable turn left timer while turn left button is down vizact.onbuttondown(lbutton,turnLeftTimer.setEnabled,True) vizact.onbuttonup(lbutton,turnLeftTimer.setEnabled,False) #Enable turn right timer while turn right button is down vizact.onbuttondown(rbutton,turnRightTimer.setEnabled,True) vizact.onbuttonup(rbutton,turnRightTimer.setEnabled,False) |
#3
|
|||
|
|||
hey, thanks loads for that, I applied a temporary texture with a UVW map in Max n then applied the video texture in Vizard n it works fine now!... and those button textures work great too, didn't realise I could apply textures to buttons on GUI, lots better than the way I was tryina do it...
thanks again... ^_^ |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Jump to video frame? | Jerry | Vizard | 1 | 10-09-2006 02:43 PM |
Video Texture Not Working on Some Objects | paulgoldberg | Vizard | 1 | 04-17-2006 01:41 PM |
How to synchronize play/pause of 2 video streams in stereo | Gilliard | Vizard | 1 | 09-01-2005 09:58 AM |
video buffer | cade_mccall | Vizard | 6 | 08-16-2005 02:48 PM |
video | jebber | Vizard | 1 | 09-28-2004 06:20 PM |