Video texture with D3D11 renderer

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
henry10210
Gnoblar
Posts: 1
Joined: Tue Jul 02, 2019 4:19 am

Video texture with D3D11 renderer

Post by henry10210 » Tue Jul 09, 2019 6:32 am

Hello, I have been trying to follow the example of "OGRE 3D 1.7 Application Development Cookbook", but I am generally stuck with the problem of D3D11 not supporting the fixed function. To recap, the "Video Texture" example Chapter 8 lets one render the video on a texture, and creates a texture and then attaches that texture to a quad (called "Screen" below) in the code like this:
Ogre::TexturePtr VideoTexture = Ogre::TextureManager::getSingleton().createManual(
"Video",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D, 640, 480, 0, Ogre::PF_R8G8B8A8, Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE);

m_PixelBuffer = VideoTexture->getBuffer();
Ogre::ManualObject *Screen = SceneManager->createManualObject("Screen");
Screen->setDynamic(true);
Screen->begin("Video", Ogre::RenderOperation::OT_TRIANGLE_LIST);

Ogre throws an exception because of the lack of fixed function. I then started reading about creating a material file (which refers to the Vertex and Fragment shaders in .cg file) but am stuck on loading the material that refers to the shaders. To begin with, I cannot even seem to specify a blank texture_unit of 640x480 as in the above example (what is the syntax anyway?). Despairing, I started reading about the RTSS in the Ogre manual, but cannot understand what ought to be a simple usage (I mean, just look at the example above!).

Can anyone kindly advise the simplest way to get a fixed size texture that I can (frame-by-frame) use as a memcpy target from a real-time video source? I do realize that an advanced usage is to arrange a texture with GPU memory that is the target of GPU based decoder (so that the frame does not travel multiple times across the PCIe bus) but for now, I would be content to just memcpy on the CPU.

Thanks in advance for any helpful suggestion you might render!
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 872
Joined: Sun Mar 30, 2014 2:51 pm
x 176
Contact:

Re: Video texture with D3D11 renderer

Post by paroj » Tue Jul 09, 2019 9:29 am

start with the code in this tutorial, which includes the RTSS setup:
https://ogrecave.github.io/ogre/api/latest/setup.html
0 x

Post Reply