How to set TextureFilter to Point to make example Bloom filter work?
- by Mr Bell
I have simple app that renders some particles and now I am trying to apply the bloom shader from the xna samplers ( http://create.msdn.com/en-US/education/catalog/sample/bloom ) to it, but I am running into this exception:
"XNA Framework HiDef profile requires TextureFilter to be Point when using texture format Vector4."
When the BloomComponent tries to end the sprite batch in the DrawFullscreenQuad method:
spriteBatch.Begin(0, BlendState.Opaque, SamplerState.PointWrap, null, null, effect);
spriteBatch.Draw(texture, new Rectangle(0, 0, width, height), Color.White);
spriteBatch.End(); //<------- Exception thrown here
It seems to be related to the pixel shaders that I am using to animate the particle. In a nutshell, I have a texture2d in vector4 format that holds particle positions, and another one for velocities. Here is a snippet from that area:
GraphicsDevice.SetRenderTarget(tempRenderTarget);
animationEffect.CurrentTechnique = animationEffect.Techniques[technique];
spriteBatch.Begin(SpriteSortMode.Immediate,
BlendState.Opaque,
SamplerState.PointWrap,
DepthStencilState.DepthRead,
RasterizerState.CullNone,
animationEffect);
spriteBatch.Draw(randomValues, new Rectangle(0, 0, width, height), Color.White);
spriteBatch.End();
What I comment out the code that calls the particle animation pixel shaders the bloom component runs fine. Is there some state that I need to reset to make the bloom work?