Jump to content
  • Advertisement
Sign in to follow this  
zhengrong

problem about D3DX_SKIP_DDS_MIP_LEVELS

This topic is 2587 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I just found out that D3DX_SKIP_DDS_MIP_LEVELS doesn't work while loading files without mipmap data.

when I load a file DOES contain mipmap data(like a dds file with mipmap chain) it works as expected. but for dds withou mipmap, or other format like jpg, it just creates all mipmap levels.

does it just work like this? or did I misunderstand anything?

here's my code:

HRESULT hr = D3DXCreateTextureFromFileInMemoryEx(m_device,
data,
size,
0,
0,
0,
0,
TEXTURE_DXT1,
D3DPOOL_MANAGED,
D3DX_DEFAULT,
D3DX_SKIP_DDS_MIP_LEVELS(3, D3DX_DEFAULT),
0,
NULL,
NULL,
&d3dTexture);

any comment will be appreciated.

Share this post


Link to post
Share on other sites
Advertisement
That's just how it works. D3DX_SKIP_DDS_MIP_LEVELS only skips existing mip levels.

If you only want to load the top level of the image, you can specify 1 for the MipLevels parameter instead of 0 (Which means "Generate a full mip chain").

Share this post


Link to post
Share on other sites
thanks!

is there anyway to create a specified mipmap level except for the first one from a texture file?


That's just how it works. D3DX_SKIP_DDS_MIP_LEVELS only skips existing mip levels.

If you only want to load the top level of the image, you can specify 1 for the MipLevels parameter instead of 0 (Which means "Generate a full mip chain").





Share this post


Link to post
Share on other sites
I believe you can use any level you want when loading from an image file, not just 0 or 1.

Moving thread to DirectX.

Share this post


Link to post
Share on other sites
thanks, but how?

D3DX_SKIP_DDS_MIP_LEVELS doesn't work for texture files that don't have mipmaps.



I believe you can use any level you want when loading from an image file, not just 0 or 1.

Moving thread to DirectX.

Share this post


Link to post
Share on other sites
You don't need the skip mip levels flag. It looks like D3DX won't let you create one specific mip level. If you pass 3, you'll get 3 levels and not level 3. I think you will need to load and set the texture data manually to do what you want.

Share this post


Link to post
Share on other sites
You can always adjust the width and height to create a texture of the size of a specific mip level, with the help of D3DXGetImageInfoFromFileInMemory().

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!