Skip to main content
GameDev.net gamedev.net
🔒 Locked

Mipmaps with D3DX??

Started by Void Jun 22, 2000 at 5:10 AM 9 replies 1.1k views
Original Post
Void
Void
Hi, Does any know how to generate mipmaps using the D3DX library. I use the D3DXCreateTextureFromFile function. The docs says it will auto generate the mipmaps if the h/w supports it. I checked the Dx Caps Viewer and it seems to support it.. but the mipmap count from the function returns ZERO.. Do I have to explicitly create a chain of texture using D3DXCreateTexture first and then loading the bitmap data in?? Thanks.. ..
Gandalf
Gandalf
Take a look at the MipMap example in DirectX SDK 7. Very good tutorial.

Gandalf the White

Gandalf the Black
Void
Void
That''s the problem.. I did look at that sample..

I''m trying to avoid traversing the surface chain and bltting every (progressively smaller) bitmap to each mipmap surface..

I was thinking in terms of auto mipmap generation like OpenGL using the aux library ..Juz wondering how the d3dx library would help me there..

..
Verminaard
Verminaard
sorry, the above post is from me.
-------------I am a Juggalo.
Void
Void
Verminaard:

Do you check the "#_mipmap" parameter you passed in?? (That is the actual number of mipmaps generated from the D3DXCreateTextureFromFile function call)

The call sets that parameter to 0 on my machine. The hresult succeeds and the "flags" paramater DOES NOT return D3DX_TEXTURE_NOMIPMAP..( the mipmap creation is not supported flag)

That is the queer part..

..
Verminaard
Verminaard
So you mean after the call num_mipmap contains the actual number created by 3d3x? I''m not sure what the return value is, but I can visibly see the mipmap working. Are you sure d3dx isn''t creating mipmaps (just from looking at the picture)?
-------------I am a Juggalo.
Void
Void
quote:
Original post by Verminaard

I can visibly see the mipmap working. Are you sure d3dx isn''t creating mipmaps (just from looking at the picture)?




You can visibly see the mipmaps working?? How is that possible unless you use a different image for each smaller mipmap like the Dx7 sample..

As for the num_mipmap parameter, this is from the d3dx Create Texture doc

    
IDirectDrawSurface7 *m_ptex;
m_pd3dDevice = m_pd3dx->GetD3DDevice();

hr = D3DXCreateTextureFromFile(
m_pd3dDevice,
NULL, // dwFlags

NULL, // auto-width

NULL, // auto-height

NULL, // auto-surface type

NULL, // pointer to Palette

&m_ptex, // returned pointer to texture

NULL, // returned number of mipmaps

"texture.bmp", // file name for texture

D3DX_FT_DEFAULT); // default scaling



From the comments there, I assume it would return the number of mipmaps generated.. or else why would it take a pointer..

Could you please check the return value and get back to me??..

..
Verminaard
Verminaard
sorry, thats from me. this is like the post that never dies.
-------------I am a Juggalo.
Void
Void
You are probably right.. I placed two textures side by side and it does seems to blur with the mipmapped one..

Guess I was over paranoid.. the width and height are references cause they will return the adjusted values so the documentation led me to believe it will return the actual mipmaps generated..

Wish the source for the d3dx lib is available so we don''t have to guess but sadly it is not a supported library..

Thanks there.. I was on the verge of discarding the d3dx lib and writing my own loader..

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.