2
\$\begingroup\$

Beginner question. Synopsis: my water effects does something that causes the drawing of my sky sphere to throw an exeption when run in full screen. The exception is:

XNA Framework HiDef profile requires TextureFilter to be Point when using texture format Vector4.

This happens both when I start in full screen directly or switch to full screen from windowed. It does NOT happen, however, if I comment out the drawing of my water.

So, what in my water effect can possibly cause the drawing of my sky sphere to choke???

\$\endgroup\$
4
  • \$\begingroup\$ Does your shader change the render states in any way? \$\endgroup\$ Feb 17, 2012 at 14:24
  • 3
    \$\begingroup\$ It might be helpful if you could show some code, especially around the area where you hit that error. \$\endgroup\$
    – Nic Foster
    Feb 17, 2012 at 15:09
  • \$\begingroup\$ Are you using BasicEffect or a custom shader? \$\endgroup\$
    – 3Dave
    Jul 28, 2012 at 20:14
  • \$\begingroup\$ With "water effect" I ment a custom shader. :-) \$\endgroup\$
    – danbystrom
    Jul 30, 2012 at 6:55

2 Answers 2

3
\$\begingroup\$

You need to set the SamplerState[0] to SamplerState.PointClamp before your DrawIndexedPrimitive call.

\$\endgroup\$
0
1
\$\begingroup\$

I think I solved the problem. I was confronted with the same problem: I used a SurfaceFormat.Single-Texture to make some displacement in my HeightmapShader and everything works until I change the resolution (switched to Full-screen or back). During this switch my SkyboxDrawer complains about exact the same thing. But my Skybox-texture was in SurfaceFormat.Color, so the exception doesn't make sense at all.

So I start googling and found out, that Sharwn Hargreaves (a programmer of XNA with a great blog on XNA and other stuff) mentioned that there is a bug in XNA4.0 connected to the correct sync of settings of the sampler states with their C# counterparts.

My sampler looks like the following, so I thought all that should be done, was done.

texture Texture;
sampler TextureSampler = sampler_state
{
    Texture = <Texture>;
    MinFilter = POINT;
    MagFilter = POINT;
    MipFilter = POINT;   
    AddressU  = Wrap;
    AddressV  = Wrap;
};

But what really solved the problem was setting the VertexTextureSampler before drawing my Heightmap. This made the given exception in my SkyboxDrawer disappear.

GraphicsDevice.VertexSamplerStates[0] = SamplerState.PointClamp;

For completeness: My SkyboxDrawer uses the BasicShader whereas my HeightmapDrawer uses a custom HeightmapShader. So the only connection between them are the states in the grafics pipeline.

But there is a unsolved "problem". As far as I know a vertex textures sampler in XNA only can use floating point based formats like SurfaceFormat.Single, SurfaceFormat.Vector2, SurfaceFormat.HalfSingle and so on. These formats require POINT sampling. So why the hell am I able to change the GraficsDevice.VertexTextureSampler[*] to something else?! Did I miss something?

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .