• Advertisement


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

Problens with testures...

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

Im trying to make a function to load textures and use mipmapping.. But I how can I copy one texture into another tuxture usign diferents formats ?? I have make a small code and its not work, I dont know much about textures, if anyone can help me... HRESULT CTexture::LoadTexture(char * Filename, bool Mipmap) { HRESULT hr; MipMapping = Mipmap; hr = D3DXCreateTextureFromFile(g_pD3DDevice, Filename, &g_pMeshTextures); if FAILED(hr) { throw CErrorMsg(hr, "[CTexture::LoadTexture]: Error in D3DXCreateTextureFromFile.\n\n Erro criando textura!\n"); return E_FAIL; } g_pD3DDevice->CreateTexture(256, 256, 5, 0, D3DFMT_R5G6B5, D3DPOOL_DEFAULT, &g_pMipMap); g_pD3DDevice->CreateTexture(256, 256, 5, 0, D3DFMT_R5G6B5, D3DPOOL_SYSTEMMEM, &g_pTemp); for (int iLevel = 0; iLevel < g_pTemp->GetLevelCount(); iLevel++) { g_pTemp->GetSurfaceLevel(iLevel, &pDstSurfaceLevel); g_pMeshTextures->GetSurfaceLevel(iLevel, &pSrcSurfaceLevel); g_pD3DDevice->CopyRects(pSrcSurfaceLevel, NULL, 1, pDstSurfaceLevel, NULL); pSrcSurfaceLevel->Release(); pDstSurfaceLevel->Release(); } g_pD3DDevice->UpdateTexture(g_pTemp, g_pMipMap); return S_OK; }

Share this post

Link to post
Share on other sites

  • Advertisement