Loading Videos

Blitz3D Forums/Blitz3D Programming/Loading Videos

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

; Simple movie on 3D Object example (rob@...)
; sample avi was a simple quicktime trailer preview converted.

; for best results and efficient memory usage please use power of two sizes.
; ie. 256x256


Graphics3D 640,480,16,2
camera=CreateCamera()
light=CreateLight()

;create texture for the movie & 3d entity
movietex = CreateTexture(256,256,256+48)
cube = CreateCube()
EntityTexture cube,movietex
MoveEntity cube,0,0,6
EntityFX cube,16
EntityBlend cube,3
For i=0 To 3
	temp=CopyEntity(cube,cube)
	PositionEntity temp,Rnd(-10,10),Rnd(-10,10),Rnd(-10,10)
Next

;load movie
movie = OpenMovie("sample.avi")

While Not KeyHit(1)
	; this is just a delay before updating movie

	If t>2
		t=0
		If MoviePlaying(movie)=0 Then movie = OpenMovie("sample.avi")
		DrawMovie(movie)
		CopyRect 0,0,256,128,0,0,BackBuffer(),TextureBuffer(movietex)
	EndIf
	t=t+1
	
	TurnEntity cube,-.4,.4,0
	RenderWorld

	Flip
Wend
End