problem about D3DX_SKIP_DDS_MIP_LEVELS

Started by
5 comments, last by Adam_42 12 years, 5 months ago
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.
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").
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").





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

Moving thread to DirectX.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
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.
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.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
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().

This topic is closed to new replies.

Advertisement