0

I am trying to render a skybox in DirectX9 with fixed function pipeline (without shader or effect file). I can view the cube rendering. When I set the texture all faces are getting painted with a single strange color (not white or blank). The texture file is a correct cube map.I think some texture setting is not set. Below is the code snippet

// for creating the cube and the cube texture

HRESULT apiResult = D3DXCreateBox(g_pd3dDevice,1,1,1,&g_pMesh,NULL);

apiResult = D3DXCreateCubeTextureFromFile(g_pd3dDevice,L"cubeMap.dds",&g_pTexture);

both APIs are returning S_OK.

// for renderin the skybox

g_pd3dDevice->SetSamplerState(0,D3DSAMP_MIPFILTER,D3DTEXF_LINEAR); g_pd3dDevice->SetSamplerState(0,D3DSAMP_MAGFILTER,D3DTEXF_LINEAR); g_pd3dDevice->SetSamplerState(0,D3DSAMP_MINFILTER,D3DTEXF_LINEAR);

// set texture

g_pd3dDevice->SetTexture(0,g_pTexture);

// Begin the scene if( SUCCEEDED( g_pd3dDevice->BeginScene() ) )

{

g_pMesh->DrawSubset(0);

g_pd3dDevice->EndScene();

}

// Present the backbuffer contents to the display

g_pd3dDevice->Present( NULL, NULL, NULL, NULL );

Which setting is missing ?

proton
  • 658
  • 1
  • 7
  • 26

1 Answers1

0

I'm not an expert but try lowering the resolution of the image you are loading, i had a similar problem once and found out that the image couldn't load because of that, the resolution was too big.

hernan
  • 1
  • 1
    thanks for the hint,but image loading is not the problem in my case same texture is working fine when used in programmable pipeline. – proton Apr 05 '13 at 15:14