Page 1 of 1

Movie over 3D

Posted: Mon Aug 11, 2025 11:57 am
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

Re: Movie over 3D

Posted: Mon Aug 11, 2025 12:14 pm
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).

Re: Movie over 3D

Posted: Mon Aug 11, 2025 4:39 pm
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:

Re: Movie over 3D

Posted: Mon Aug 11, 2025 10:37 pm
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.