Sampling is the process of taking values from an input at regular intervals. The more values we take the more accurate the resultant representation.
It is important to remember that we are rendering our graphics onto a finite sized grid of pixels (the size of the grid is the screen resolution) and it is this restriction that can cause problems. E.g. if you render a 16 by 16 texture onto an object that is close up to the camera it may actually take up 100 by 100 screen pixels and so will need to be stretched. The effect will be a horrible blocky texture. To solve this we can apply filtering techniques like bilinear filtering.
The device method:
HRESULT SetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE State, DWORD Value );
e.g. to turn on bilinear filtering for texturing:
device->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
device->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
device->SetSamplerState( 0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR );
Textures are mapped onto geometry using U and V values. UV value of 1,1 is the bottom right of the texture while 0,0 is the top left. If looking at a texture U values increase to the right and V values increase downward. If we go beyond 1 we can repeat (tile) the texture. How these situations are handled can be define via these states.
All the above default to D3DTADDRESS_WRAP.
When a texture is rendered to the screen at a larger size than it was created we say it has been magnified. If it is rendered at a smaller size we say it has been minified.
Note: not all graphic cards will support all filtering methods. All cards support point and most nowadays support linear. For the others you need to check what the card supports. To do this you can first use the CheckDeviceFormat function with D3DUSAGE_QUERY_FILTER to see if texture filtering is supported.
E.g to test if a graphic card supports texture filtering in hardware:
device->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL , adapterFormat, D3DUSAGE_QUERY_FILTER,D3DRTYPE_TEXTURE, textureFormat)
adapterFormat and textureFormat will depend on your implementation.
If this call succeeds the texture filtering is supported. To find out what methods are supported requires querying of the device caps (device capabilities) - to do this use the GetDeviceCaps device function.
I have described the most common sampler states, for others and for more detail please look in the DirectX help or see the MSDN page here: SetSamplerState
Sampler State Default Value