这是两种正确的的放法:
\
for( int j = 0; j \< 2; j++ ){\
LightTexEffect-\>SetMatrix( WorldMatrixHandle, &g\_WorldMatrix[j] );\
for(int i = 0; i \< numPasses; i++)\
{\
LightTexEffect-\>BeginPass(i);\
g\_ObjMesh[j]-\>Render( Device );\
LightTexEffect-\>EndPass();\
}\
}
\
for(int i = 0; i \< numPasses; i++)\
{\
for( int j = 0; j \< 2; j++ ){\
LightTexEffect-\>SetMatrix( WorldMatrixHandle, &g\_WorldMatrix[j] );\
LightTexEffect-\>BeginPass(i);\
g\_ObjMesh[j]-\>Render( Device );\
LightTexEffect-\>EndPass();\
}\
}
效果如图:

当放错的时候,即
for(int i = 0; i \< numPasses; i++)\
{\
LightTexEffect-\>BeginPass(i);\
for( int j = 0; j \< 2; j++ ){\
LightTexEffect-\>SetMatrix( WorldMatrixHandle, &g\_WorldMatrix[j] );\
g\_ObjMesh[j]-\>Render( Device );\
}\
LightTexEffect-\>EndPass();\
}
\
产生如下效果:
