Playing video as a texture or multiple textures

malcolm

Newcomer
Joined
Feb 1, 2004
Messages
9
i seen the dx sample (misc > c# > texture) it shown a cylinder rendering a video as a texture..

the code had some eventhandlers.. but den .. it only starts rendering when it has a texture render.. and i tried to insert a boolean into the TextureRenderEventArgs

so that i can render in my Onpaint or render overrides..

but it couldnt work..

has anyone sucessfully managed to render a video as a texture?..
help needed...

edit some of the code..
bRender is my bool
void RenderIt(object sender, TextureRenderEventArgs e){
lock(this)
{
texture = e.Texture;
bRender = true;
}
}

protected override Render(){
if(bRender){
RenderTexture();
}
}
failed.......
 
Last edited:
Im Trying Im trying,..

In VB the closest ive come is to get the first (or last not sure) frame to render, now i think i might be playing the video at warp speed but im not sure, i just see some colors flashing for less than a second,... Ugg not working at all.....
 
Ok

All ive been able to play is the first frame,.. And i have no idea what the flashing colors where but im pretty sure it wasnt my movie playing too fast.
 
Finnally Got It

Visual Basic:
Public MainDevice as Direct3d.device
Dim Video as new Video(filename)
'Create a vertex Buffer descriping the area you want to draw on
'i used Transformed Textured Vertex Format and full screen....
'I can only get it to draw full screen as im not sure how to do 
'dirty rectangles properly if anyone would like to show me that 
' would be greatly appreciated
Dim VB as vertexbuffer 'then create your area to draw on....
public Sub Play_Video()
addhandler Video.texturereadytorender,addressof Render
video.rendertotexture(maindevice)
end sub
public Sub Render(sender as object,e as texturereadyeventargs) 'not sure the actual name off the top of my head but im sure you can figure it out easy enough
MainDevice.VertexFormat = VB.vertexformat
MainDevice.setstreamsource 0,vb,0
maindevice.settexture 0,e.texture
maindevice.clear(target,color.black,0,0)
maindevice.beginscrene
maindevice.drawprimitives(trianglestrip,0,2)
maindevice.endscene
maindevice.present
end sub
In other Words simply re render the area you want to draw on when the textureready event happens,.. My thoughts have been either play the video full screen and stop everything else until its done or create an if statement in the texture ready event or something so that the function wont disrupt the rest of what your trying to render if it occers during another loop rendering,.. Im not even sure that is possible but its about midnight and time for me to go to sleep just thought id share this finnally working code with you.
 
this is totally dumb..

MS updated to DX 9.0b SDK
and now they remove the Video reference from it..

therefore one has to use the DX 9.0A SDK to code the video.. but wts the point when the sdk is no longer avaliable for download PLUS there are alot of things missing in DX 9.0A.. espcially font stuff and some other stuf.f..


MS.. i wld say did not do a very good job in upgrading to 9.0B...
 
Back
Top