XNA Creators Club Online
Page 1 of 1 (3 items)
Sort Posts: Previous Next

Mipmaps in a WinForms-nested device

Last post 1/28/2009 9:06 PM by Klasker. 2 replies.
  • 1/28/2009 5:10 PM

    Mipmaps in a WinForms-nested device

    I have nested an XNA graphics device in a windows form using the GraphicsDeviceControl from the WinFormsGraphicsDevice sample. The problem is that my textures do not seem to use their mipmaps, even though they have the "Generate Mipmaps" property enabled. When I render them from a Game class in the same project, the mipmaps work perfectly, and the visual difference is quite obvious.

    Any ideas why this happens? Does Game or GraphicsDeviceManager do some secret magic? I am simply loading the content using a ContentManager like in the first sample - I'm not using the dynamic pipeline from the second sample.

    I have tried both with and without the "Application.EnableVisualStyles();" line in my Main method, and both in an XNA Window Game project and a regular Windows Forms project.
  • 1/28/2009 6:16 PM In reply to

    Re: Mipmaps in a WinForms-nested device

    To render with mipmaps, you need two things:

    • The texture has to contain mipmaps
    • Mipmapping has to be enabled on the GPU

    To check the first, look at the LevelCount property of your texture after you load it.

    To check the second, look at SamplerStates[0].MipFilter.
    XNA Framework Developer - blog - homepage
  • 1/28/2009 9:06 PM In reply to

    Re: Mipmaps in a WinForms-nested device

    Thanks! Setting SamplerStates[0].MipFilter to Linear during initialization solved the problem. I'm confused why it ignored "MipFilter = Linear" in the FX file's sampler_state block, but anyhow the problem was solved.
Page 1 of 1 (3 items) Previous Next