Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

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.......

Edited by malcolm
Posted

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.....

  • 2 weeks later...
Posted

Finnally Got It

 

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.

Posted

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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...