This project has moved and is read-only. For the latest updates, please go here.

EnvironmentMapEffect not working

Mar 14, 2014 at 6:19 PM

I am attempting to use EnvironmentMapEffect to create a skybox. I use this example in attempting to get it working:
IEffect* myeffect = ...

Microsoft::WRL::ComPtr<ID3D11InputLayout> inputLayout;
shape->CreateInputLayout( myeffect, &inputLayout );

shape->Draw( myeffect, inputLayout.Get() );
When run, D3D reports that there is an unfilled sampler slot. Even after fixing this, I get nothing displaying. When I change the above code to use a standard texture, it all works fine.

Note the same situation applies to DualTextureEffect.
Mar 14, 2014 at 7:50 PM
What is your 'shape' object? If it is a GeometricPrimitive, then it is only setting up a D3D11SamplerState object in slot 0.

DualTextureEffect and EnvironmentMapEffect both require a sampler in slot 0 and 1.

If you are using GeometricPrimitive, you use the setCustomState callback on Draw to get called back and do the setup of both samplers:
CommonStates states(device);

shape->Draw( myeffect, inputLayout.Get(), false, false, [=]
    ID3D11SamplerState* samplerState[2] = { states.LinearClamp(), states.LinearWrap() };
    deviceContext->PSSetSamplers(0, 2, &samplerState);
Marked as answer by walbourn on 3/14/2014 at 11:50 AM