rifter1818
Junior Contributor
I finnally got video rendering to texture FINNALLY but it only works in windowed mode, as soon as i go to full screen it only renders the first frame and then stops ?! Please help
All this is inside my D3D class which has a working initialised device, Note that it worked in Windowed mode, the DX9.video currently is just an audiovideoplayback.video (or whatever the basic dx video is) there is outside of the class another addhandler for video.ending that starts the gameloop (as this is the intro movie that im trying to get to work.
Visual Basic:
Public Sub PlayVideo(ByVal video As Dx9.Video)
Try
AddHandler video.TextureReadyToRender, AddressOf RenderVideo
VBVid = New VertexBuffer(GetType(CustomVertex.TransformedTextured), 4, Me.device, 0, CustomVertex.TransformedTextured.Format, Pool.Default)
Dim Verts As CustomVertex.TransformedTextured() = DirectCast(VBVid.Lock(0, 0), CustomVertex.TransformedTextured())
With Verts(0)
.X = 0
.Y = 0
.Z = 0
.Rhw = 1
.Tu = 0
.Tv = 0
End With
With Verts(1)
.X = device.DisplayMode.Width
.Y = 0
.Z = 0
.Rhw = 1
.Tu = 1
.Tv = 0
End With
With Verts(2)
.X = 0
.Y = device.DisplayMode.Height
.Z = 0
.Rhw = 1
.Tu = 0
.Tv = 1
End With
With Verts(3)
.X = device.DisplayMode.Width
.Y = device.DisplayMode.Height
.Z = 0
.Rhw = 1
.Tu = 1
.Tv = 1
End With
VBVid.Unlock()
video.RenderToTexture(device)
Catch ex As Exception
Debug.WriteLine(ex.ToString)
LastException = ex
End Try
End Sub
Private Sub RenderVideo(ByVal sender As Object, ByVal e As TextureRenderEventArgs)
Clear(System.Drawing.Color.Black)
BeginScene()
device.SetStreamSource(0, VBVid, 0)
device.VertexFormat = VBVid.Description.VertexFormat
device.SetTexture(0, e.Texture)
device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2)
EndScene()
Present()
End Sub