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
Posts: 1
Joined: Tue Jul 02, 2019 4:19 am

Video texture with D3D11 renderer

Post by henry10210 »

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(
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->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!

OGRE Team Member
OGRE Team Member
Posts: 972
Joined: Sun Mar 30, 2014 2:51 pm
x 292

Re: Video texture with D3D11 renderer

Post by paroj »

start with the code in this tutorial, which includes the RTSS setup:

Post Reply