Menu

D3D 9 Rendering

2013-08-14
2014-08-21
  • Gaius Julius Caesar

    Hello! First of all id like to express my joy towards this library. libtheoraplayer was the best and free solution to my opengl project - it's fast, it works and very easy to use. However, i started to port my project to d3d and encountered slight difficulty with video playback. Frankly speaking, im total newbie in dx environment, so the question is: how do you pass texture data via frame loop?

    frame=clip->getNextFrame();
    if (frame)
    {...

    It would very nice to have full direct x example included into examples section.

    Thank you for your attention!

     

    Last edit: Gaius Julius Caesar 2013-08-14
  • Krešimir Špes

    Krešimir Špes - 2013-08-16

    Hi Caesar,

    check this thread for more info: https://sourceforge.net/p/libtheoraplayer/forum/general/thread/9d59e9a8/

    Also, for a general texture writing tutorial, search google for "DirectX procedural textures".

     
  • Krešimir Špes

    Krešimir Špes - 2014-08-20

    Hi David,

    from the looks of it, your code seems to be ok.

    I'd just change the way you're copying data to speed things up. You're doing a double for loop and copying each pixel individually which is very slow. What you should be doing is just do a memcpy() from the theoravideoframe to the texture buffer. If you chose the texture format correctly when creating a video clip, the library will already prepare the frames in the format you need. This is better because pixel conversion is best done in the theora worker threads in a hardware accelerated way then you doing it in the main thread unoptimised.

     
  • Konstanty Kalicki

    You won't be able to memcpy whole buffer, because DX textures have padded rows. However even using memcpy to copy whole rows will speed things significantly. Here is a snippet from my code hastly eddited to fit your naming convention:

    for(s32 row =0;row<last_frame->getHeight();row++){
    memcpy( &bits[row*lTexPitch], &mb[rowlast_frame->getHeight()4 ], last_frame->getHeight()*4 );
    }

    Edit: this code will work with RGBA texture and video, you will have to ensure both buffer and dx tex are in same format

     

    Last edit: Konstanty Kalicki 2014-08-20
  • Krešimir Špes

    Krešimir Špes - 2014-08-21

    oh yeah, forgot about that part of directx,buy yeah, a series of line memcpy's should be good.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.