Archived

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

GeorgeV

Mipmap not change texture

Recommended Posts

I set mipmap but the program render only the level 2 texture. What''s wrong? Thanks: George Varga The Code: --------- ... IDirect3DTexture8 *m_pMipMap; ... D3DXCreateTexture(m_pd3dDevice, Width, Height, 3, 0, D3DFMT_R8G8B8, D3DPOOL_MANAGED, &m_pMipMap) IDirect3DSurface8 *pSurfaceLevel; D3DXIMAGE_INFO d3dii; for (int iLevel = 0; iLevel < (int)m_pMipMap->GetLevelCount(); iLevel++) { m_pMipMap->GetSurfaceLevel(iLevel, &pSurfaceLevel); //Process this level. if( iLevel == 0 ){ D3DXLoadSurfaceFromFile( pSurfaceLevel, NULL, NULL, "Media\\bmp1000.bmp", NULL, D3DX_FILTER_TRIANGLE, 0, &d3dii ); } if( iLevel == 1 ){ D3DXLoadSurfaceFromFile( pSurfaceLevel, NULL, NULL, "Media\\bmp500.bmp", NULL, D3DX_FILTER_TRIANGLE, 0, &d3dii ); } if( iLevel == 2 ){ D3DXLoadSurfaceFromFile( pSurfaceLevel, NULL, NULL, "Media\\bmp250.bmp", NULL, D3DX_FILTER_TRIANGLE, 0, &d3dii ); } pSurfaceLevel->Release(); } ... m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTEXF_POINT ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER, D3DTEXF_POINT ); // m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MIPFILTER, D3DTEXF_POINT ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MAXMIPLEVEL, 3 ); float fBias = -4.0f; m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MIPMAPLODBIAS, *((LPDWORD) (&fBias))); ... m_pd3dDevice->SetTexture(0, m_pMipMap);

Share this post


Link to post
Share on other sites
I change this line:

m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MAXMIPLEVEL, 3 );

to:

m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MAXMIPLEVEL, 0 );

and program works fine.

George Varga

Share this post


Link to post
Share on other sites
I change this line:

m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MAXMIPLEVEL, 3 );

to:

m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MAXMIPLEVEL, 0 );

and program works fine.

George Varga

Share this post


Link to post
Share on other sites