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.
Convert Image to IrrlichtTexture
-
- Posts: 34
- Joined: Thu Feb 05, 2009 11:37 am
- Location: Koblenz, Germany
hm, obviously I've really got a clever compiler...
I tried it again with the memcpy method
but it changed nothing with the speed. Thank you for answering so patiently
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();
Think Tannenzäpfle!