Commits

Fred...@Baator  committed 9dc1f0e

some renaming (ogre-movingcube -> ogre-testscene)

  • Participants
  • Parent commits 77f68f8

Comments (0)

Files changed (12)

File OgreVideoCanvas/include/OgreVideoCanvas.h

 
 protected:
     SceneManager *mSceneMgr;
-    String mVideoFileName;
+    String mVideoFileName, mVideoBaseName;
     SceneNode *mCanvasNode;
     ManualObject *mCanvas;
     OgreVideoTexture *mVideoTexture;

File OgreVideoCanvas/include/OgreVideoTexture.h

     void _initTexture(Ogre::TexturePtr);
     void _updateTextureFromImage(const IplImage*);
     void _destroyTexture();
-
    
     inline void _copyImagePerLine(const IplImage*, Ogre::HardwarePixelBufferSharedPtr);
     inline void _copyImagePerPixel(const IplImage*, Ogre::HardwarePixelBufferSharedPtr);
     inline void _copyImagePerChannel(const IplImage*, Ogre::HardwarePixelBufferSharedPtr);
 
+    void _logMessage(const Ogre::String&);
+
 protected:
-    Ogre::String mVideoFileName;
+    Ogre::String mVideoFileName, mVideoBaseName;
+    Ogre::String mTextureName, mMaterialName;
     CvCapture *mCvCapture;
     IplImage *mCurrentVideoFrame;
     Ogre::TexturePtr mVideoTexture;
     Ogre::MaterialPtr mVideoMaterial;
-    Ogre::String mTextureName, mMaterialName;
     Ogre::Timer mTimeSinceLastUpdate;
     int mFrameCount, mCurrentFrameIndex;
+    Ogre::Timer mTimer;
     Ogre::Log *mLog;
-    Ogre::Timer mTimer;
+    bool mIsLoggingEvents;
 };

File OgreVideoCanvas/src/OgreVideoCanvas.cpp

     ,mHeight(480)
     ,mTextureSize(1024)
 {
+    Ogre::String out;
+    Ogre::StringUtil::splitFilename(mVideoFileName, mVideoBaseName, out);
 }
 //------------------------------------------------------------------------------
 OgreVideoCanvas::~OgreVideoCanvas(void)
     float uMax = float(mWidth)  / mTextureSize;
     float vMax = float(mHeight) / mTextureSize;
 
-    mCanvas = mSceneMgr->createManualObject("Video Canvas " + mVideoFileName);
+    mCanvas = mSceneMgr->createManualObject("Video Canvas " + mVideoBaseName);
     mCanvas->begin("BaseWhiteNoLighting", RenderOperation::OT_TRIANGLE_STRIP);
 
     mCanvas->position(-mWidth/2,  mHeight/2, 0);   mCanvas->textureCoord(uMin, vMax);     mCanvas->normal(Ogre::Vector3::NEGATIVE_UNIT_Z);
 
     mCanvas->end();
 
-    mCanvasNode = _parentNode->createChildSceneNode("Canvas Node " + mVideoFileName);
+    mCanvasNode = _parentNode->createChildSceneNode("Canvas Node " + mVideoBaseName);
     mCanvasNode ->attachObject(mCanvas);
     mCanvasNode->yaw(Degree(180.0));
     mCanvasNode->roll(Degree(180.0));

File OgreVideoCanvas/src/OgreVideoTexture.cpp

     ,mCvCapture(NULL)
     ,mCurrentVideoFrame(NULL)
     ,mCurrentFrameIndex(0)
+    ,mLog(NULL)
+    ,mIsLoggingEvents(false)
 {
-    mLog = Ogre::LogManager::getSingletonPtr()->createLog("OgreVideoTexture_"+_filename+".log");
-    mMaterialName = "Video Material "+ mVideoFileName;
-    mTextureName = "Video Texture " + mVideoFileName;
+    Ogre::String out;
+    Ogre::StringUtil::splitFilename(mVideoFileName, mVideoBaseName, out);
+
+    mMaterialName = "Video Material "+ mVideoBaseName;
+    mTextureName = "Video Texture " + mVideoBaseName;
+    if (mIsLoggingEvents)
+        mLog = Ogre::LogManager::getSingletonPtr()->createLog("OgreVideoTexture_"+mVideoBaseName+".log");
+    
     _init();
 }
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 void OgreVideoTexture::_init()
 {
-    mLog->logMessage("init");
+    _logMessage("init");
     
 
     _initCapture();
     mTimeSinceLastUpdate.reset();
 
      
-    mLog->logMessage("init done");
+    _logMessage("init done");
 }
 //------------------------------------------------------------------------------
 void OgreVideoTexture::_initCapture()
 {
-    Ogre::String fullName = Ogre::String("../media/videos/") + mVideoFileName;
-    mCvCapture = cvCreateFileCapture(fullName.c_str());
+    
+    mCvCapture = cvCreateFileCapture(mVideoFileName.c_str());
     mFrameCount = cvGetCaptureProperty(mCvCapture, CV_CAP_PROP_FRAME_COUNT);
 
     // skip first frame
     cvGrabFrame(mCvCapture);
     mCurrentFrameIndex++;
 
-    mLog->logMessage("openned " + fullName);
+    _logMessage("openned " + mVideoFileName);
 }
 //------------------------------------------------------------------------------
 void OgreVideoTexture::_endCapture()
     mCurrentFrameIndex = 0;
     mCurrentVideoFrame = NULL;
     mCvCapture = NULL;
-    mLog->logMessage("video file" + mVideoFileName + "ended");
+    
+    _logMessage("video file" + mVideoFileName + "ended");
 }
 //------------------------------------------------------------------------------
 void OgreVideoTexture::_reinitCapture()
     }
     else
     {
-        // reinit
         _reinitCapture();
-        //_endCapture();
-        //_initCapture();
     }
 }
 //------------------------------------------------------------------------------
                 *pDest++ = 0;   // G
                 *pDest++ = 0; // R
             }
-
         }
  
         pixelBuffer->unlock();
 //------------------------------------------------------------------------------
 void OgreVideoTexture::_updateTextureFromImage(const IplImage *_image)
 {
-    mTimer.reset();
+    if (mIsLoggingEvents)
+        mTimer.reset();
+    
     // Get the pixel buffer
     Ogre::HardwarePixelBufferSharedPtr pixelBuffer = mVideoTexture->getBuffer();
 
     //_copyImagePerLine(_image, pixelBuffer);
     _copyImagePerPixel(_image, pixelBuffer);
 
-
-    boost::format fmt("%1% (%2%) : %3% �s");
     
-    fmt % "write to texture" 
-        % mCurrentFrameIndex
-        % mTimer.getMicroseconds();
-    
-    mLog->logMessage(fmt.str());
+    if (mIsLoggingEvents)
+    {        
+        boost::format fmt("%1% (%2%) : %3% �s");
+        
+        fmt % "write to texture" 
+            % mCurrentFrameIndex
+            % mTimer.getMicroseconds();
+        
+        _logMessage(fmt.str());
+    }
 }
 //------------------------------------------------------------------------------
 void OgreVideoTexture::_copyImagePerLine(const IplImage *_image
 
     _pixelBuffer->unlock();
 }
+//------------------------------------------------------------------------------
+void OgreVideoTexture::_logMessage(const Ogre::String &_msg)
+{
+    if (mIsLoggingEvents)
+        mLog->logMessage(_msg);
+}

File ogre-movingcube.sln

 
 Microsoft Visual Studio Solution File, Format Version 10.00
 # Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ogre-movingcube", "ogre-movingcube\ogre-movingcube.vcproj", "{66616D12-AD9C-42C9-8685-99CD59E7BEC3}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ogre-testscene", "ogre-testscene\ogre-testscene.vcproj", "{66616D12-AD9C-42C9-8685-99CD59E7BEC3}"
 	ProjectSection(ProjectDependencies) = postProject
 		{6DC85AAB-1822-4031-BCD6-7F54ECAABC37} = {6DC85AAB-1822-4031-BCD6-7F54ECAABC37}
 	EndProjectSection

File ogre-movingcube/OgreDShow/UtilsOgreDshow.cpp

-// Ogre Dshow: small wrapper for video reproduction in Ogre, using Direct Show 9.
-/*
-   Wrapper for video reproduction using Direct Show in the Ogre 3d engine.
-
-   Coded by H. Hern�n Moraldo from Moraldo Games
-   www.hernan.moraldo.com.ar/pmenglish/field.php
-
-   --------------------
-
-   Copyright (c) 2007 Horacio Hernan Moraldo
-
-   This software is provided 'as-is', without any express or
-   implied warranty. In no event will the authors be held liable
-   for any damages arising from the use of this software.
-
-   Permission is granted to anyone to use this software for any
-   purpose, including commercial applications, and to alter it and
-   redistribute it freely, subject to the following restrictions:
-
-   1. The origin of this software must not be misrepresented; you
-   must not claim that you wrote the original software. If you use
-   this software in a product, an acknowledgment in the product
-   documentation would be appreciated but is not required.
-
-   2. Altered source versions must be plainly marked as such, and
-   must not be misrepresented as being the original software.
-
-   3. This notice may not be removed or altered from any source
-   distribution.
-
-*/
-#include "UtilsOgreDshow.h"
-#include "UtilsOgreDshow_private.h"
-#include <OgreStringConverter.h>
-#include <dshow.h>
-
-
-namespace OgreUtils
-{
-	DirectShowMovieTexture::DirectShowMovieTexture(int width, int height, bool dontModifyDimensions)
-	{
-		// 1) CREATE DSDATA
-		dsdata=new DirectShowData;
-
-		// 2) CREATE TEXTURE
-		// get width and height to the next square of two
-		int twoSquared;
-		mTexWidth=0; mTexHeight=0;
-		for (twoSquared=2; mTexWidth==0 || mTexHeight==0; twoSquared*=2)
-		{
-			if (mTexWidth==0 && twoSquared>=width)
-				mTexWidth=twoSquared;
-			if (mTexHeight==0 && twoSquared>=height)
-				mTexHeight=twoSquared;
-		}
-		if (dontModifyDimensions)
-		{
-			// back to the original dimensions
-			mTexWidth=width;
-			mTexHeight=height;
-		}
-
-		// log it
-		Ogre::LogManager::getSingletonPtr()->logMessage(
-			Ogre::String("[DSHOW] Creating texture with dimensions ")+
-			Ogre::StringConverter::toString(mTexWidth)+"x"+
-			Ogre::StringConverter::toString(mTexHeight)+".");
-
-		// first, create the texture we are going to use
-		mTexture=Ogre::TextureManager::getSingleton().createManual(
-			"DirectShowManualTexture",// name
-			Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
-			Ogre::TEX_TYPE_2D,// texture type
-			mTexWidth,
-			mTexHeight,
-			0,// number of mipmaps
-			Ogre::PF_BYTE_BGRA,// pixel format
-			Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE// usage
-			);
-
-		// 3) INITIALIZE DIRECT SHOW
-		HRESULT hr;
-
-		hr=CoInitialize(NULL);
-		if (FAILED(hr)) throw("[DSHOW] Error in co initialize");
-
-		// initialize all pointers
-		dsdata->pGraph=0;
-		dsdata->pControl=0;
-		dsdata->pEvent=0;
-		dsdata->pGrabberF=0;
-		dsdata->pGrabber=0;
-		dsdata->pSeeking=0;
-		dsdata->pWindow=0;
-
-
-}
-
-	DirectShowMovieTexture::~DirectShowMovieTexture()
-	{
-		// 1) DEINITIALIZE DIRECT SHOW
-		unloadMovie();
-		CoUninitialize();
-
-		// 2) DESTROY TEXTURE
-		Ogre::TextureManager::getSingleton().remove(mTexture->getName());
-
-		// 3) DELETE DSDATA
-		delete dsdata;
-	}
-
-	void DirectShowMovieTexture::loadMovie(
-		const Ogre::String& moviePath, bool horizontalMirroring)
-	{
-		HRESULT hr;
-
-		// log it!
-		Ogre::LogManager::getSingletonPtr()->logMessage(
-			Ogre::String("[DSHOW] Loading movie named '")+
-			moviePath+"'.");
-
-		// destroy previous movie objects (if any)
-		unloadMovie();
-
-		// create filter graph and get interfaces
-		hr=CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
-			IID_IGraphBuilder, (void**) &dsdata->pGraph);
-		if (FAILED(hr)) throw("[DSHOW] Error in creating graph");
-
-		hr=dsdata->pGraph->QueryInterface(IID_IMediaControl, (void**) & dsdata->pControl);
-		if (FAILED(hr)) throw("[DSHOW] Error in querying media control");
-
-		hr=dsdata->pGraph->QueryInterface(IID_IMediaEvent, (void**) & dsdata->pEvent);
-		if (FAILED(hr)) throw("[DSHOW] Error in querying media event");
-
-		hr=dsdata->pGraph->QueryInterface(IID_IMediaSeeking, (void**) & dsdata->pSeeking);
-		if (FAILED(hr)) throw("[DSHOW] Error in querying seeking interface");
-
-		// create sample grabber
-		hr=CoCreateInstance(CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER,
-			IID_IBaseFilter, (void**)&dsdata->pGrabberF);
-		if (FAILED(hr)) throw("[DSHOW] Error in creating sample grabber");
-
-		// add sample grabber to the graph
-		hr=dsdata->pGraph->AddFilter(dsdata->pGrabberF, L"Sample Grabber");
-		if (FAILED(hr)) throw("[DSHOW] Error in adding sample grabber to the graph");
-
-		// get sample grabber object
-		dsdata->pGrabberF->QueryInterface(IID_ISampleGrabber,
-			(void**)&dsdata->pGrabber);
-
-		// set sample grabber media type
-		AM_MEDIA_TYPE mt;
-		ZeroMemory(&mt, sizeof(AM_MEDIA_TYPE));
-		mt.majortype = MEDIATYPE_Video;
-		mt.subtype = MEDIASUBTYPE_RGB24;
-		mt.formattype = FORMAT_VideoInfo;
-		hr=dsdata->pGrabber->SetMediaType(&mt);
-		if (FAILED(hr)) throw("[DSHOW] Error in setting sample grabber media type");
-
-                //--------------- Seregvan's modification 
-		IBaseFilter* srcFilter; 
-		WCHAR* filepath = util_convertCStringToWString(moviePath.c_str());    
-		hr = dsdata->pGraph->AddSourceFilter(filepath, L"Source", &srcFilter); 
-		if(FAILED(hr)) throw ("[DSHOW] Unsupported media type!"); 
-
-		// Connect the src and grabber 
-		hr = ConnectFilters(dsdata->pGraph, srcFilter, dsdata->pGrabberF); 
-		if(FAILED(hr)) throw ("[DSHOW] Unsupported media type!"); 
-
-		IBaseFilter * render;
-		hr = CoCreateInstance(CLSID_NullRenderer, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&render);
-		if(FAILED(hr)) throw ("[DSHOW] Unsupported media type!"); 
-
-		dsdata->pGraph->AddFilter(render, L"Render");
-
-		hr = ConnectFilters(dsdata->pGraph, dsdata->pGrabberF, render); 
-		if(FAILED(hr)) throw ("[DSHOW] Can't create render!"); 
-
-		//--------------- End of modification
-
-		// open the file!
-		WCHAR* filepath=util_convertCStringToWString(moviePath.c_str());
-		hr=dsdata->pGraph->RenderFile(filepath, NULL);
-		if (FAILED(hr)) throw("[DSHOW] Error opening video file!");
-
-		// disable auto show
-		// (wouldn't be needed if we used the null renderer)
-		hr=dsdata->pGraph->QueryInterface(IID_IVideoWindow, (void**) & dsdata->pWindow);
-		if (FAILED(hr)) throw("[DSHOW] Error getting video window interface");
-		dsdata->pWindow->put_AutoShow(OAFALSE);
-
-		// get video information
-		AM_MEDIA_TYPE mtt;
-		hr=dsdata->pGrabber->GetConnectedMediaType(&mtt);
-		if (FAILED(hr)) throw("[DSHOW] Error getting connected media type info");
-
-		VIDEOINFOHEADER *vih = (VIDEOINFOHEADER*) mtt.pbFormat;
-		dsdata->videoWidth=vih->bmiHeader.biWidth;
-		dsdata->videoHeight=vih->bmiHeader.biHeight;
-		// microsoft's help version of free media type
-		if (mtt.cbFormat != 0)
-		{
-			CoTaskMemFree((PVOID)mtt.pbFormat);
-			mtt.cbFormat = 0;
-			mtt.pbFormat = NULL;
-		}
-		if (mtt.pUnk != NULL)
-		{
-			mtt.pUnk->Release();
-			mtt.pUnk = NULL;
-		}
-
-		// log it
-		Ogre::LogManager::getSingletonPtr()->logMessage(
-			Ogre::String("[DSHOW] -> This movie has dimensions: ")+
-			Ogre::StringConverter::toString(dsdata->videoWidth)+"x"+
-			Ogre::StringConverter::toString(dsdata->videoHeight)+".");
-
-
-		// set sampling options
-		dsdata->pGrabber->SetOneShot(FALSE);
-		dsdata->pGrabber->SetBufferSamples(TRUE);
-
-		// set some basic data
-		mHorizontalMirroring=horizontalMirroring;
-
-		// clean the texture, so that it's ready for rendering this video
-		cleanTextureContents();
-	}
-
-	Ogre::Vector2 DirectShowMovieTexture::getMovieDimensions()
-	{
-		return Ogre::Vector2(dsdata->videoWidth, dsdata->videoHeight);
-	}
-	
-	void DirectShowMovieTexture::unloadMovie()
-	{
-		if (dsdata->pGraph==0)
-			return;
-
-		if (dsdata->pGrabber!=0)
-		{
-			dsdata->pGrabber->Release();
-			dsdata->pGrabber=0;
-		}
-		if (dsdata->pGrabberF!=0)
-		{
-			dsdata->pGrabberF->Release();
-			dsdata->pGrabberF=0;
-		}
-		if (dsdata->pWindow!=0)
-		{
-			dsdata->pWindow->Release();
-			dsdata->pWindow=0;
-		}
-		if (dsdata->pSeeking!=0)
-		{
-			dsdata->pSeeking->Release();
-			dsdata->pSeeking=0;
-		}
-		if (dsdata->pControl!=0)
-		{
-			dsdata->pControl->Release();
-			dsdata->pControl=0;
-		}
-		if (dsdata->pEvent!=0)
-		{
-			dsdata->pEvent->Release();
-			dsdata->pEvent=0;
-		}
-		if (dsdata->pGraph!=0)
-		{
-			dsdata->pGraph->Release();
-			dsdata->pGraph=0;
-		}
-
-	}
-
-	void DirectShowMovieTexture::pauseMovie()
-	{
-		// pause!
-		if (dsdata->pControl)
-			dsdata->pControl->Pause();
-	}
-
-	void DirectShowMovieTexture::playMovie()
-	{
-		// play!
-		if (dsdata->pControl)
-			dsdata->pControl->Run();
-	}
-
-	void DirectShowMovieTexture::rewindMovie()
-	{
-		if (!dsdata->pSeeking) return;
-
-		// rewind!
-		LONGLONG p1=0;
-		LONGLONG p2=0;
-
-        dsdata->pSeeking->SetPositions(
-			&p1, AM_SEEKING_AbsolutePositioning, &p2, AM_SEEKING_NoPositioning);
-	}
-
-	void DirectShowMovieTexture::stopMovie()
-	{
-		// stop!
-		if (dsdata->pControl)
-			dsdata->pControl->Stop();
-	}
-
-
-	Ogre::TexturePtr DirectShowMovieTexture::getMovieTexture()
-	{
-		return mTexture;
-	}
-
-	void DirectShowMovieTexture::updateMovieTexture()
-	{
-		HRESULT hr;
-		unsigned int i, idx;
-		int x, y;
-		BYTE* bmpTmp;
-
-		// only do this if there is a graph that has been set up
-		if (!dsdata->pGraph)
-			return;
-
-		// Find the required buffer size.
-		long cbBuffer = 0;
-		hr = dsdata->pGrabber->GetCurrentBuffer(&cbBuffer, NULL);
-		if (cbBuffer<=0)
-		{
-			// nothing to do here yet
-			return;
-		}
-
-		char *pBuffer = new char[cbBuffer];
-		if (!pBuffer) 
-		{
-			// out of memory!
-			throw("[DSHOW] Out of memory or empty buffer");
-		}
-		hr = dsdata->pGrabber->GetCurrentBuffer(&cbBuffer, (long*)pBuffer);
-		if (hr==E_INVALIDARG || hr==VFW_E_NOT_CONNECTED || hr==VFW_E_WRONG_STATE)
-		{
-			// we aren't buffering samples yet, do nothing
-			delete[] pBuffer;
-			return;
-		}
-		if (FAILED(hr)) throw("[DSHOW] Failed at GetCurrentBuffer!");
-
-		// OGRE BEGIN
-		// OGRE TEXTURE LOCK
-		// get the texture pixel buffer
-		int texw=mTexture->getWidth();
-		int texh=mTexture->getHeight();
-		Ogre::HardwarePixelBufferSharedPtr pixelBuffer = mTexture->getBuffer();
-		bmpTmp=(BYTE*)pBuffer;
-
-		// lock the pixel buffer and get a pixel box
-		pixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD);
-		const Ogre::PixelBox& pixelBox = pixelBuffer->getCurrentLock();
-
-		Ogre::uint8* pDest = static_cast<Ogre::uint8*>(pixelBox.data);
-
-		// FILL!
-		// check for mirroring...
-		bool shouldBeMirrored=mHorizontalMirroring;
-		if (shouldBeMirrored){
-			x=dsdata->videoWidth-1; y=dsdata->videoHeight-1;
-		}else{
-			x=0; y=dsdata->videoHeight-1;
-		}
-
-		// go set all bits...
-		for (i=0; i<(dsdata->videoWidth*dsdata->videoHeight*3); i+=3){
-			idx=(x*4)+y*pixelBox.rowPitch*4;
-
-			// paint
-			pDest[idx]=bmpTmp[i];//b
-			pDest[idx+1]=bmpTmp[i+1];//g
-			pDest[idx+2]=bmpTmp[i+2];//r
-			pDest[idx+3]=255;//a
-
-			if (shouldBeMirrored){
-				x--;
-				if (x<0){
-					x=dsdata->videoWidth-1;
-					y--; if (y<0) y=0;
-				}
-			}else{
-				x++;
-				if (x>=dsdata->videoWidth){
-					x=0;
-					y--; if (y<0) y=0;
-				}
-			}
-		}
-
-		// UNLOCK EVERYTHING!
-		// unlock the pixel buffer
-		pixelBuffer->unlock();
-		// OGRE END
-
-		// bye
-		delete[] pBuffer;
-	}
-
-	void DirectShowMovieTexture::cleanTextureContents()
-	{
-		unsigned int idx;
-		int x, y;
-
-		// OGRE TEXTURE LOCK
-		// get the texture pixel buffer
-		int texw=mTexture->getWidth();
-		int texh=mTexture->getHeight();
-		Ogre::HardwarePixelBufferSharedPtr pixelBuffer = mTexture->getBuffer();
-
-		// lock the pixel buffer and get a pixel box
-		pixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD);
-		const Ogre::PixelBox& pixelBox = pixelBuffer->getCurrentLock();
-
-		Ogre::uint8* pDest = static_cast<Ogre::uint8*>(pixelBox.data);
-
-		// FILL!
-		for (x=0, y=0; y<texh; ){
-			idx=(x*4)+y*pixelBox.rowPitch*4;
-
-			// paint
-			pDest[idx]=0;//b
-			pDest[idx+1]=0;//g
-			pDest[idx+2]=0;//r
-			pDest[idx+3]=255;//a
-
-			x++;
-			if (x>=texw)
-			{
-				x=0;
-				y++;
-			}
-		}
-
-		// UNLOCK EVERYTHING!
-		// unlock the pixel buffer
-		pixelBuffer->unlock();
-		// OGRE END
-	}
-
-
-	bool DirectShowMovieTexture::isPlayingMovie()
-	{
-		OAFilterState pfs;
-		HRESULT hr;
-
-		if (dsdata->pEvent!=NULL){
-			long ev, p1, p2;
-
-			while (E_ABORT!=dsdata->pEvent->GetEvent(&ev, &p1, &p2, 0)){
-				// check for completion
-				if (ev==EC_COMPLETE)
-				{
-					pauseMovie();
-					return false;
-				}
-
-				// release event params
-				hr=dsdata->pEvent->FreeEventParams(ev, p1, p2);
-				if (FAILED(hr))
-				{
-					pauseMovie();
-					return false;
-				}
-			}
-		}
-
-		// get the running state!
-		if (dsdata->pControl!=NULL)
-		{
-			hr=dsdata->pControl->GetState(0, &pfs);
-			if (FAILED(hr))
-			{
-				pauseMovie();
-				return false;
-			}
-
-			return pfs==State_Running;
-		}
-
-		// it hasn't even been initialized!
-		return false;
-	}
-
-	WCHAR* util_convertCStringToWString(const char* string)
-	{
-		const int MAX_STRINGZ=500;
-		static WCHAR wtext[MAX_STRINGZ+2];
-
-		if (strlen(string)>MAX_STRINGZ)
-			return 0;
-
-		// convert text to wchar
-		if (MultiByteToWideChar(
-			CP_ACP,// ansi code page
-			0,// flags
-			string,// orig string
-			-1,// calculate len
-			wtext,// where to put the string
-			MAX_STRINGZ)// maximum allowed path
-			==0)
-		{
-			throw("[DSHOW] convertCStringToWString failed with no extra error info");
-		}
-
-		return wtext;
-	}
-
-
-}

File ogre-movingcube/OgreDShow/UtilsOgreDshow.h

-// Ogre Dshow: small wrapper for video reproduction in Ogre, using Direct Show 9.
-/*
-   Wrapper for video reproduction using Direct Show in the Ogre 3d engine.
-
-   Coded by H. Hern�n Moraldo from Moraldo Games
-   www.hernan.moraldo.com.ar/pmenglish/field.php
-
-   --------------------
-
-   Copyright (c) 2007 Horacio Hernan Moraldo
-
-   This software is provided 'as-is', without any express or
-   implied warranty. In no event will the authors be held liable
-   for any damages arising from the use of this software.
-
-   Permission is granted to anyone to use this software for any
-   purpose, including commercial applications, and to alter it and
-   redistribute it freely, subject to the following restrictions:
-
-   1. The origin of this software must not be misrepresented; you
-   must not claim that you wrote the original software. If you use
-   this software in a product, an acknowledgment in the product
-   documentation would be appreciated but is not required.
-
-   2. Altered source versions must be plainly marked as such, and
-   must not be misrepresented as being the original software.
-
-   3. This notice may not be removed or altered from any source
-   distribution.
-
-*/
-
-#ifndef __FILE_UTILSOGREDSHOW_INCLUDED
-#define __FILE_UTILSOGREDSHOW_INCLUDED
-
-
-#define __FILE_UTILSOGREDSHOW_VERSION "11-18-2008a"
-
-#include <Ogre.h>
-#include <OgreVector2.h>
-
-namespace OgreUtils
-{
-	struct DirectShowData;
-
-	/// A class for playing movies in an ogre texture
-	class DirectShowMovieTexture
-	{
-	public:
-		// cons / decons
-		/// Initializes the dshow object, and creates a texture with the given dimensions.
-		/**
-		If dontModifyDimensions is false, the system might modify the texture dimensions
-		by setting them to the nearest power of two (useful for old computers).
-		(Ie, 1024x512 if the original dimensions were 640x480).
-		*/
-		DirectShowMovieTexture(int width, int height, bool dontModifyDimensions=true);
-		/// Destroys the dshow object
-		virtual ~DirectShowMovieTexture();
-
-		// basic movie methods
-		/// Loads a given movie
-		/**
-		/param moviePath A string telling the full path of the file to be loaded.
-		/param horizontalMirroring A bool telling whether the video should be rendered
-		as if seen through a mirror, or not.
-		*/
-		void loadMovie(const Ogre::String& moviePath, bool horizontalMirroring=false);
-		/// Obtains the dimensions of the current movie
-		Ogre::Vector2 getMovieDimensions();
-		/// Unloads the current movie
-		void unloadMovie();
-
-		// methods for movie control
-		/// Pauses the current movie
-		void pauseMovie();
-		/// Starts playing the current movie
-		void playMovie();
-		/// Makes the current movie rewind
-		void rewindMovie();
-		/// Stops the current movie
-		void stopMovie();
-		/// Is the latest video put to play, now playing?
-		/** (This is an old implementation of mine; I guess I should re-check this) */
-		bool isPlayingMovie();
-
-		// methods on movie texture
-		/// Obtain the ogre texture where the movie is rendered
-		Ogre::TexturePtr getMovieTexture();
-		/// Render a movie frame in the ogre texture
-		void updateMovieTexture();
-	protected:
-		/// Texture where to render the movie
-		Ogre::TexturePtr mTexture;
-		/// Real texture width
-		Ogre::Real mTexWidth;
-		/// Real texture height
-		Ogre::Real mTexHeight;
-		/// Direct Show specific data
-		DirectShowData* dsdata;
-		/// Do we do horizontal mirroring by software?
-		bool mHorizontalMirroring;
-
-		/// Clean the full texture (paint it all black)
-		void cleanTextureContents();
-	};
-}
-
-
-#endif // __FILE_UTILSOGREDSHOW_INCLUDED

File ogre-movingcube/OgreDShow/UtilsOgreDshow_private.h

-/// Do not include this file directly, always use UtilsOgreDshow.h instead.
-// Ogre Dshow: small wrapper for video reproduction in Ogre, using Direct Show 9.
-/*
-   Wrapper for video reproduction using Direct Show in the Ogre 3d engine.
-
-   Coded by H. Hern�n Moraldo from Moraldo Games
-   www.hernan.moraldo.com.ar/pmenglish/field.php
-
-   --------------------
-
-   Copyright (c) 2007 Horacio Hernan Moraldo
-
-   This software is provided 'as-is', without any express or
-   implied warranty. In no event will the authors be held liable
-   for any damages arising from the use of this software.
-
-   Permission is granted to anyone to use this software for any
-   purpose, including commercial applications, and to alter it and
-   redistribute it freely, subject to the following restrictions:
-
-   1. The origin of this software must not be misrepresented; you
-   must not claim that you wrote the original software. If you use
-   this software in a product, an acknowledgment in the product
-   documentation would be appreciated but is not required.
-
-   2. Altered source versions must be plainly marked as such, and
-   must not be misrepresented as being the original software.
-
-   3. This notice may not be removed or altered from any source
-   distribution.
-
-*/
-
-#ifndef __FILE_UTILSOGREDSHOW_PRIVATE_INCLUDED
-#define __FILE_UTILSOGREDSHOW_PRIVATE_INCLUDED
-
-#include <dshow.h>
-#include <Qedit.h>// for sample grabber
-#include <windows.h>
-
-
-namespace OgreUtils
-{
-	struct DirectShowData
-	{
-		/// Graph object
-		IGraphBuilder *pGraph;
-		/// Media control object
-		IMediaControl *pControl;
-		/// Media event object
-		IMediaEvent *pEvent;
-		/// Grabber filter
-		IBaseFilter *pGrabberF;
-		/// Grabber object
-		ISampleGrabber *pGrabber;
-		/// Interface for seeking object
-		IMediaSeeking *pSeeking;
-		/// Window interface
-		/** Useful for some configuration
-		*/
-		IVideoWindow *pWindow;
-
-		/// Video output width
-		int videoWidth;
-		/// Video output height
-		int videoHeight;
-	};
-
-	/// Util function for converting C strings to wide strings
-	/** (as needed for path in directshow). */
-	WCHAR* util_convertCStringToWString(const char* string);
-}
-
-
-#endif // __FILE_UTILSOGREDSHOW_PRIVATE_INCLUDED

File ogre-movingcube/ogre-movingcube.cpp

-
-
-#include <map>
-#include <boost/foreach.hpp>
-
-#include "OgreVideoCanvas.h"
-//#include "OgreVideoTexture.h"
-#include "ExampleApplication.h"
-
-
-
-
-class TutorialFrameListener : public ExampleFrameListener
-{
-public:
-    TutorialFrameListener(RenderWindow* win, Camera* cam, SceneManager *sceneMgr
-                          , SceneNode *canvasNode
-                          , OgreVideoCanvas *_videoCanvas
-                          , OgreVideoCanvas *_videoCanvas2)
-		: ExampleFrameListener(win, cam, false, false)
-	{
-		// key and mouse state tracking
-		mMouseDown = false;
-		mToggle = 0.0;
-
-		// Populate the camera and scene manager containers
-		mCamNode = cam->getParentSceneNode();
-		mSceneMgr = sceneMgr;
-
-		// set the rotation and move speed
-		mRotate = 0.13;
-		mMoveSpeed = 500;
-
-		mCanvasNode = canvasNode;
-        mVideoCanvas = _videoCanvas;
-        mVideoCanvas2 = _videoCanvas2;
-	}
-
-
-	bool frameStarted(const FrameEvent &evt)
-	{
-        //mCanvasNode->roll(Degree(1.0) * evt.timeSinceLastFrame * 100);
-        mVideoCanvas->nextFrame();
-        mVideoCanvas2->nextFrame();
-
-		if(mKeyboard->isKeyDown(OIS::KC_ESCAPE))
-			return false;
-
-		return true;
-
-	}
-
-protected:
-	bool mMouseDown;       // Whether or not the left mouse button was down last frame
-	Real mToggle;          // The time left until next toggle
-	Real mRotate;          // The rotate constant
-	Real mMove;            // The movement constant
-	SceneManager *mSceneMgr;   // The current SceneManager
-	SceneNode *mCamNode;   // The SceneNode the camera is currently attached to
-    SceneNode *mCanvasNode;
-    OgreVideoCanvas *mVideoCanvas, *mVideoCanvas2;
-	
-};
-
-class TutorialApplication : public ExampleApplication
-{
-public:
-	TutorialApplication()
-	{
-	}
-
-	~TutorialApplication() 
-	{
-	}
-protected:
-	void createCamera(void)
-	{
-		// create camera, but leave at default position
-		mCamera = mSceneMgr->createCamera("PlayerCam"); 
-		mCamera->setNearClipDistance(5);
-	}
-
-	void createScene(void)
-	{
-        
-		mSceneMgr->setAmbientLight(ColourValue(0.25, 0.25, 0.25));
-
-		Light *light = mSceneMgr->createLight("Light1");
-		light->setType(Light::LT_POINT);
-		light->setPosition(Vector3(0, 300, 600));
-		light->setDiffuseColour(ColourValue::White);
-		light->setSpecularColour(ColourValue::White);
-
-		// Create the scene node
-		SceneNode *yawnode = mSceneMgr->getRootSceneNode()->createChildSceneNode("YawCamNode1");
-        Ogre::SceneNode *node = yawnode->createChildSceneNode("CamNode1", Vector3(0, 100, 1000));
-		node->attachObject(mCamera);
-
-
-        mCanvasNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("Canvas Node", Vector3(0, 100, 0));       
-        mVideoCanvas = new OgreVideoCanvas("liege.avi", mSceneMgr);
-        mVideoCanvas->buildCanvas(mCanvasNode);
-
-
-        mCanvasNode2 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Canvas Node2", Vector3(700, 100, 0));       
-        mVideoCanvas2 = new OgreVideoCanvas("indochine.avi", mSceneMgr);
-        mVideoCanvas2->buildCanvas(mCanvasNode2);
-	}
-
-
-
-	void createFrameListener(void)
-	{
-		// Create the FrameListener
-		mFrameListener = 
-            new TutorialFrameListener(mWindow, mCamera, mSceneMgr
-                                    , mCanvasNode, mVideoCanvas, mVideoCanvas2);
-		mRoot->addFrameListener(mFrameListener);
-	}
-
-protected:
-    SceneNode *mCanvasNode, *mCanvasNode2;
-    //typedef VideoCanvasItem std::pair<String, OgreVideoCanvas*>;
-    //std::map<String, OgreVideoCanvas*> mVideoCanvases;
-    OgreVideoCanvas *mVideoCanvas;
-    OgreVideoCanvas *mVideoCanvas2;
-};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
-#define WIN32_LEAN_AND_MEAN
-#include "windows.h"
-
-INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
-#else
-int main(int argc, char **argv)
-#endif
-{
-	// Create application object
-	TutorialApplication app;
-
-	try {
-		app.go();
-	} catch(Exception& e) {
-#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
-		MessageBoxA(NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
-#else
-		fprintf(stderr, "An exception has occurred: %s\n",
-			e.getFullDescription().c_str());
-#endif
-	}
-
-	return 0;
-}

File ogre-movingcube/ogre-movingcube.vcproj

-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="9,00"
-	Name="ogre-movingcube"
-	ProjectGUID="{66616D12-AD9C-42C9-8685-99CD59E7BEC3}"
-	RootNamespace="ogremovingcube"
-	Keyword="Win32Proj"
-	TargetFrameworkVersion="196613"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="1"
-			CharacterSet="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="..\OgreVideoCanvas\include;&quot;$(BOOST_HOME)\&quot;;&quot;$(OGRE16_HOME)\OgreMain\include&quot;;&quot;$(OGRE16_HOME)\Dependencies\include&quot;;&quot;$(OGRE16_HOME)\Samples\Common\include&quot;;&quot;C:\libs\OpenCV-1.1\cvaux\include&quot;;&quot;C:\libs\OpenCV-1.1\cv\include&quot;;&quot;C:\libs\OpenCV-1.1\cxcore\include&quot;;&quot;C:\libs\OpenCV-1.1\otherlibs\highgui&quot;"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				DebugInformationFormat="4"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="OgreMain_d.lib OIS_d.lib OgreGUIRenderer_d.lib cvd.lib cvauxd.lib cxcored.lib highguid.lib OgreVideoCanvas_d.lib"
-				LinkIncremental="2"
-				AdditionalLibraryDirectories="&quot;$(OGRE16_HOME)\lib&quot;;&quot;$(OGRE16_HOME)\Dependencies\lib\$(ConfigurationName)&quot;;&quot;C:\libs\OpenCV-1.1\lib&quot;;..\OgreVideoCanvas\lib"
-				GenerateDebugInformation="true"
-				SubSystem="2"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="1"
-			CharacterSet="1"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				EnableIntrinsicFunctions="true"
-				AdditionalIncludeDirectories="..\OgreVideoCanvas\include;&quot;$(BOOST_HOME)\&quot;;&quot;$(OGRE16_HOME)\OgreMain\include&quot;;&quot;$(OGRE16_HOME)\Dependencies\include&quot;;&quot;$(OGRE16_HOME)\Samples\Common\include&quot;;&quot;C:\libs\OpenCV-1.1\cvaux\include&quot;;&quot;C:\libs\OpenCV-1.1\cv\include&quot;;&quot;C:\libs\OpenCV-1.1\cxcore\include&quot;;&quot;C:\libs\OpenCV-1.1\otherlibs\highgui&quot;"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="true"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="OgreMain.lib OIS.lib OgreGUIRenderer.lib cv.lib cvaux.lib cxcore.lib highgui.lib OgreVideoCanvas.lib"
-				LinkIncremental="1"
-				AdditionalLibraryDirectories="&quot;$(OGRE16_HOME)\lib&quot;;&quot;$(OGRE16_HOME)\Dependencies\lib\$(ConfigurationName)&quot;;&quot;C:\libs\OpenCV-1.1\lib&quot;;..\OgreVideoCanvas\lib"
-				GenerateDebugInformation="true"
-				SubSystem="2"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<File
-				RelativePath=".\ogre-movingcube.cpp"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-			>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>

File ogre-testscene/ogre-testscene.cpp

+
+
+#include <map>
+#include <boost/foreach.hpp>
+
+#include "OgreVideoCanvas.h"
+//#include "OgreVideoTexture.h"
+#include "ExampleApplication.h"
+
+
+
+
+class TutorialFrameListener : public ExampleFrameListener
+{
+public:
+    TutorialFrameListener(RenderWindow* win, Camera* cam, SceneManager *sceneMgr
+                          , SceneNode *canvasNode
+                          , OgreVideoCanvas *_videoCanvas
+                          , OgreVideoCanvas *_videoCanvas2)
+		: ExampleFrameListener(win, cam, false, false)
+	{
+		// key and mouse state tracking
+		mMouseDown = false;
+		mToggle = 0.0;
+
+		// Populate the camera and scene manager containers
+		mCamNode = cam->getParentSceneNode();
+		mSceneMgr = sceneMgr;
+
+		// set the rotation and move speed
+		mRotate = 0.13;
+		mMoveSpeed = 500;
+
+		mCanvasNode = canvasNode;
+        mVideoCanvas = _videoCanvas;
+        mVideoCanvas2 = _videoCanvas2;
+	}
+
+
+	bool frameStarted(const FrameEvent &evt)
+	{
+        //mCanvasNode->roll(Degree(1.0) * evt.timeSinceLastFrame * 100);
+        mVideoCanvas->nextFrame();
+        mVideoCanvas2->nextFrame();
+
+		if(mKeyboard->isKeyDown(OIS::KC_ESCAPE))
+			return false;
+
+		return true;
+
+	}
+
+protected:
+	bool mMouseDown;       // Whether or not the left mouse button was down last frame
+	Real mToggle;          // The time left until next toggle
+	Real mRotate;          // The rotate constant
+	Real mMove;            // The movement constant
+	SceneManager *mSceneMgr;   // The current SceneManager
+	SceneNode *mCamNode;   // The SceneNode the camera is currently attached to
+    SceneNode *mCanvasNode;
+    OgreVideoCanvas *mVideoCanvas, *mVideoCanvas2;
+	
+};
+
+class TutorialApplication : public ExampleApplication
+{
+public:
+	TutorialApplication()
+	{
+	}
+
+	~TutorialApplication() 
+	{
+	}
+protected:
+	void createCamera(void)
+	{
+		// create camera, but leave at default position
+		mCamera = mSceneMgr->createCamera("PlayerCam"); 
+		mCamera->setNearClipDistance(5);
+	}
+
+	void createScene(void)
+	{
+        
+		mSceneMgr->setAmbientLight(ColourValue(0.25, 0.25, 0.25));
+
+		Light *light = mSceneMgr->createLight("Light1");
+		light->setType(Light::LT_POINT);
+		light->setPosition(Vector3(0, 300, 600));
+		light->setDiffuseColour(ColourValue::White);
+		light->setSpecularColour(ColourValue::White);
+
+		// Create the scene node
+		SceneNode *yawnode = mSceneMgr->getRootSceneNode()->createChildSceneNode("YawCamNode1");
+        Ogre::SceneNode *node = yawnode->createChildSceneNode("CamNode1", Vector3(0, 100, 1000));
+		node->attachObject(mCamera);
+
+
+        mCanvasNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("Canvas Node", Vector3(0, 100, 0));       
+        mVideoCanvas = new OgreVideoCanvas("../media/videos/liege.avi", mSceneMgr);
+        mVideoCanvas->buildCanvas(mCanvasNode);
+
+
+        mCanvasNode2 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Canvas Node2", Vector3(700, 100, 0));       
+        mVideoCanvas2 = new OgreVideoCanvas("../media/videos/indochine.avi", mSceneMgr);
+        mVideoCanvas2->buildCanvas(mCanvasNode2);
+	}
+
+
+
+	void createFrameListener(void)
+	{
+		// Create the FrameListener
+		mFrameListener = 
+            new TutorialFrameListener(mWindow, mCamera, mSceneMgr
+                                    , mCanvasNode, mVideoCanvas, mVideoCanvas2);
+		mRoot->addFrameListener(mFrameListener);
+	}
+
+protected:
+    SceneNode *mCanvasNode, *mCanvasNode2;
+    //typedef VideoCanvasItem std::pair<String, OgreVideoCanvas*>;
+    //std::map<String, OgreVideoCanvas*> mVideoCanvases;
+    OgreVideoCanvas *mVideoCanvas;
+    OgreVideoCanvas *mVideoCanvas2;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+#define WIN32_LEAN_AND_MEAN
+#include "windows.h"
+
+INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
+#else
+int main(int argc, char **argv)
+#endif
+{
+	// Create application object
+	TutorialApplication app;
+
+	try {
+		app.go();
+	} catch(Exception& e) {
+#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+		MessageBoxA(NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
+#else
+		fprintf(stderr, "An exception has occurred: %s\n",
+			e.getFullDescription().c_str());
+#endif
+	}
+
+	return 0;
+}

File ogre-testscene/ogre-testscene.vcproj

+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9,00"
+	Name="ogre-testscene"
+	ProjectGUID="{66616D12-AD9C-42C9-8685-99CD59E7BEC3}"
+	RootNamespace="ogretestscene"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\OgreVideoCanvas\include;&quot;$(BOOST_HOME)\&quot;;&quot;$(OGRE16_HOME)\OgreMain\include&quot;;&quot;$(OGRE16_HOME)\Dependencies\include&quot;;&quot;$(OGRE16_HOME)\Samples\Common\include&quot;;&quot;C:\libs\OpenCV-1.1\cvaux\include&quot;;&quot;C:\libs\OpenCV-1.1\cv\include&quot;;&quot;C:\libs\OpenCV-1.1\cxcore\include&quot;;&quot;C:\libs\OpenCV-1.1\otherlibs\highgui&quot;"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="OgreMain_d.lib OIS_d.lib OgreGUIRenderer_d.lib cvd.lib cvauxd.lib cxcored.lib highguid.lib OgreVideoCanvas_d.lib"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories="&quot;$(OGRE16_HOME)\lib&quot;;&quot;$(OGRE16_HOME)\Dependencies\lib\$(ConfigurationName)&quot;;&quot;C:\libs\OpenCV-1.1\lib&quot;;..\OgreVideoCanvas\lib"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="..\OgreVideoCanvas\include;&quot;$(BOOST_HOME)\&quot;;&quot;$(OGRE16_HOME)\OgreMain\include&quot;;&quot;$(OGRE16_HOME)\Dependencies\include&quot;;&quot;$(OGRE16_HOME)\Samples\Common\include&quot;;&quot;C:\libs\OpenCV-1.1\cvaux\include&quot;;&quot;C:\libs\OpenCV-1.1\cv\include&quot;;&quot;C:\libs\OpenCV-1.1\cxcore\include&quot;;&quot;C:\libs\OpenCV-1.1\otherlibs\highgui&quot;"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="OgreMain.lib OIS.lib OgreGUIRenderer.lib cv.lib cvaux.lib cxcore.lib highgui.lib OgreVideoCanvas.lib"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="&quot;$(OGRE16_HOME)\lib&quot;;&quot;$(OGRE16_HOME)\Dependencies\lib\$(ConfigurationName)&quot;;&quot;C:\libs\OpenCV-1.1\lib&quot;;..\OgreVideoCanvas\lib"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\ogre-testscene.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>