Movie over 3D

Everything related to 3D programming
User avatar
minimy
Enthusiast
Enthusiast
Posts: 594
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Movie over 3D

Post by minimy »

Simple trip to play movie over 3D background.

Code: Select all

InitMovie():InitEngine3D(#PB_Engine3D_DebugLog):InitSprite():InitKeyboard():InitMouse()
OpenWindow(0, 0,0, 1280,720, "Movie test",#PB_Window_ScreenCentered)
video= TextGadget(#PB_Any,0,0,WindowWidth(0)/2,WindowHeight(0)/2,""):SetGadgetColor(video,#PB_Gadget_BackColor,0):HideGadget(video,1)
OpenWindowedScreen(WindowID(0), 0, 0, WindowWidth(0),WindowHeight(0), 0, 0, 0)

e= CreateEntity(#PB_Any,MeshID(CreatePlane(#PB_Any,10,10,10,10,10,10)),MaterialID(CreateMaterial(#PB_Any,#Null,$555555)))
CreateCamera(0,0,0,100,100):MoveCamera(0,-20,10,-20,#PB_Absolute):CameraLookAt(0,0,0,0)
CreateLight(0,$ffffff,3,3,3)

movi.s="C:\yourmovie.wmv" ;6.02 use wmv for compatibility. 6.21 can play mp4 too
LoadMovie(0,movi): ResizeMovie(0,0,0,GadgetWidth(video),GadgetHeight(video))

Repeat
  While WindowEvent():Wend
  ExamineMouse(): ExamineKeyboard()
  
  If KeyboardReleased(#PB_Key_V)
    If IsMovie(0)
      If MovieStatus(0) > 0
        StopMovie(0):HideGadget(video,1)
      Else
        PlayMovie(0,GadgetID(video)):HideGadget(video,0)
      EndIf
    EndIf
  EndIf
  
  RotateEntity(e,0,1,0,#PB_Relative)
  renderTime= RenderWorld()
    
  FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)
End
If translation=Error: reply="Sorry, Im Spanish": Endif
BarryG
Addict
Addict
Posts: 4155
Joined: Thu Apr 18, 2019 8:17 am

Re: Movie over 3D

Post by BarryG »

minimy wrote: Mon Aug 11, 2025 11:57 am6.21 can play mp4 too
Just for the record: so can 6.10 and lower (it's not a 6.21 feature).
User avatar
minimy
Enthusiast
Enthusiast
Posts: 594
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Re: Movie over 3D

Post by minimy »

Hi BarryG! I'm sorry, I didn't know.
I have installed only 6.02 and 6.21. 6.02 because it doesn't give me problems and it's really stable. With PB6.21 just to be up to date and when I use movies, bones, or PF_shadoko shaders. Do you know if the new shadoko shaders can work with 6.02? Or they're just for OGRE 1.4. Thanks for the information friend! (You'll never go to sleep without knowing something new) :mrgreen:
If translation=Error: reply="Sorry, Im Spanish": Endif
BarryG
Addict
Addict
Posts: 4155
Joined: Thu Apr 18, 2019 8:17 am

Re: Movie over 3D

Post by BarryG »

I don't know anything about OGRE or 3D coding, sorry. But I do know that I've been playing MP4 movies with PureBasic for decades. It'll play any video that has codecs installed on your PC for it.
Post Reply