Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap;

This will set the first SamplerState to PointWrap. Do this before you call your spriteBatch.Begin();.

share|improve this answer
    
Sadly, this does not help, I get still the same exception –  Mr Bell Nov 18 '11 at 15:11
    
What should each of these states be set to? –  Mr Bell Nov 18 '11 at 16:28
    
I checked the states of these before and after the spriteBatch.begin() and with my particle system turned on and off, and they are always the same. DepthStencilState = none, BlendSate = AlphaBlend, and RasterizerState = CullCounterClockwise –  Mr Bell Nov 18 '11 at 18:48
    
I set the SamplerStates on element 1 instead of 0 and it works now. Thanks –  Mr Bell Nov 18 '11 at 18:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.