Convert Image to IrrlichtTexture

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

There's simply no data structure for pixel arrays in shaders. You cannot pass such data to a shader.
Maybe you didn't compile with optimizations or your compiler is very clever, but memcpy should be approx. 10x faster than your method.
Siebenschläfer
Posts: 34
Joined: Thu Feb 05, 2009 11:37 am
Location: Koblenz, Germany

Post by Siebenschläfer »

hm, obviously I've really got a clever compiler...
I tried it again with the memcpy method

Code: Select all


   cvCvtColor( frame, m_AplphaFrame, CV_BGR2BGRA ); 

   // must be set to alpha 255 because in OpenCV it is set to 0
   cvSet( m_MaskFrame, cvScalar( 0, 0, 0, 255 ) ); 

	cvAdd( m_AplphaFrame, m_MaskFrame, m_AplphaFrame ); 

	// read the pixels directly into the texture 
	memcpy( (char*)( videoTexture->lock() ), 
		    (char*) m_AplphaFrame->imageData, 
			m_AlphaSize );    

	videoTexture->unlock(); 

but it changed nothing with the speed. Thank you for answering so patiently
Think Tannenzäpfle!
Post Reply