The blur is already working. The problem is when I want to apply the blur to a texture for example, I just call addBlurPass();, which calls addPass(m_MotionBlurPass). Doing that on purpose, make the engine so slow after many times.
Do you mean I have to addPasses at init for all texture materials, but how do I activate it, when I want to blur the texture ?
here the init Materials
private function intiMaterials():void
{
bitmaps = new Vector.<BitmapData>();
var matrix:Matrix = new Matrix();
for (var i:int = 0; i < 3; i++)
{
bitmaps.push( new reelTexture_1().bitmapData);
bitmaps.push( new reelTexture_2().bitmapData);
bitmaps.push( new reelTexture_3().bitmapData);
bitmaps.push( new reelTexture_4().bitmapData);
bitmaps.push( new reelTexture_5().bitmapData);
bitmaps.push( new reelTexture_6().bitmapData);
bitmaps.push( new reelTexture_7().bitmapData);
bitmaps.push( new reelTexture_8().bitmapData);
bitmaps.push( new reelTexture_9().bitmapData);
bitmaps.push( new reelTexture_10().bitmapData);
bitmaps.push( new reelTexture_11().bitmapData);
bitmaps.push( new reelTexture_12().bitmapData);
}
render = new BitmapData ( 128 , 128 , false, 0xFFFFFF );
_m_finalSymbols = new Vector.<TrivialTextureMaterial>();
for (var j:int = 0; j < bitmaps.length; j++)
{
_m_finalSymbols.push(new TrivialTextureMaterial( new BitmapTexture(bitmaps[j] ) ) );
}
}
Then If I want to blur a texture or make it normal I do that
/* Switch textures to blurry ones by applying the fragmenet shader*/
public function addBlurforAllSymbols():void
{
for each (var t:TrivialTextureMaterial in _m_finalSymbols)
{
//t.addBlurPass();
}
}
/* Switch textures to normal ones by applying the fragmenet shader pass*/
public function addNormalTextureforAllSymbols():void
{
for each (var t:TrivialTextureMaterial in _m_finalSymbols)
{
//t.addNormalPass();
}
The problem is when calling the above functions several times, the FPS drop a lot. What is wrong with my approach technically ?