Create an Effect (Direct3D 10)

An effect is created by loading it into the effects framework. If the effect has never been compiled, it will be compiled when it is created. Effects that are already loaded into memory can be created by calling D3DX10CreateEffectFromMemory. The following code example uses D3DX10CreateEffectFromFile to create an effect from a file.

ID3D10Effect* g_pEffect10 = NULL; 

// Read the effect file 
D3DX10CreateEffectFromFile( "BasicHLSL10.fx", NULL, NULL,
  D3D10_SHADER_ENABLE_STRICTNESS, 0, pd3dDevice, NULL, NULL, 
  &g_pEffect10, NULL );

Reading an effect requires the same parameters as compiling an effect, plus a device and a pool.

Rendering an Effect (Direct3D 10)