This topic is now archived and is closed to further replies.

Dx8 - Creating a mip map from a file

This topic is 6017 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

Hi there, I am just looking for a little assistance here please, in regards to DirectX 8. What I am trying to do is create a mip map from a file. The problem I have though is that when I call the D3DXCreateTextureFromFile function, with what I think are the required details, it says that this function does not take XX parameters. I have tried everything I can think of, according to the way that the Dx8 SDK says it should be given parameters, but its all just a bit too much for this little Dx8 n00b. Presently I am loading the base texture at present like this - if( FAILED( D3DXCreateTextureFromFile( g_d3d_device, d3dxMaterials[i] .pTextureFilename, &g_pMeshTextures[i] ) ) ) Which works well, but I can't get the mip mapped version to work. I have looked at the MS example in the SDK, but they only show it using the straight CreateTexture function. Is anyone able to demostrate for me, how a mip map is created using the D3DXCreateTextureFromFile function? Thanks heaps, Ikland Edited by - Ikland on January 30, 2001 7:38:09 PM

Share this post

Link to post
Share on other sites
The function will automatically generate all the mip-map surfaces and shrink the image onto the smaller surfaces for you, but you have to have mip-mapping filtering turned on, ie-

g_pD3DDevice->SetTextureStageState ( 0, D3DTSS_MIPFILTER, D3DTEXF_LINEAR );

Share this post

Link to post
Share on other sites
That line doesnt create a mipmap chain, it only sets the filtering method to use to get the pixel color between mipmap levels. You can create a mipmap chain when you load in the mipmap with these functions:
DXUtil_FindMediaFile(strPath1, "grass.bmp");
D3DX_DEFAULT, //width is taken from the image, or can put in a number here

D3DX_DEFAULT, //height is taken from the image

D3DX_DEFAULT, //default or 0 creates a complete mipmap chain down to 1x1 pixels

0, //should be 0

D3DFMT_R8G8B8, //24 bit image



0, //color key



Edited by - Possibility on June 21, 2001 1:51:24 AM

Share this post

Link to post
Share on other sites