Generate MipMaps and access them

Started by
2 comments, last by Buckeye 16 years ago
Hi, I have a texture created with mipmaps, I want to be able to access the individual levels, when I use the D3DUSAGE_AUTOGENMIPMAP its not possible to access anything above level 0. My question is: Is it possible to access these levels via some other function other than GetSurfaceLevel? or Is there an easy way to scale the first surface level on a texture created without the D3DUSAGE_AUTOGENMIPMAP so I can create the chain myself? Thanks
Advertisement
What do the Debug Runtimes say? So long as you use the D3DUSAGE_AUTOGENMIPMAP flag, the other mip levels should be generated, so you should be able to lock them just fine.

You could also just use IDirect3DBaseTexture9::GenerateMipSubLevels(), but specifying the D3DUSAGE_AUTOGENMIPMAP flag just calls that function internally anyway.
The DirectX SDK page about Auto Generated MipMaps says that "Sublevel generation from this point on is completely transparent to the application. Only the top texture level is accessible to the application; the texture sublevels are not accessible since they will be created only when needed by the driver." The function IDirect3DBaseTexture9::GenerateMipSubLevels() is a hint to the driver that this would be a good time to generate the levels. If you are loading from a file or resource D3DX can generate the Mip levels for you.
Roboticus makes a good point.

FYI: In the utility source for DxTex (texture viewer) in the SDK, when viewing a mipmap level, even Microsoft generates a new texture to display and accesses the original mipmapped texture only to get a surface description.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

This topic is closed to new replies.

Advertisement