|
|
小弟刚开始学VS/PS,遇到一点问题.
D3D Code ------------------------------------------------------
class CShadeTest
{
............
IDirect3DVertexShader9* _pDiffShader;
ID3DXConstantTable* _pDiffConstTable;
...........
}
..........
HRESULT hr = D3DXCompileShaderFromFile( "Shade.txt", NULL, NULL, "Main", "vs_1_1", D3DXSHADER_DEBUG, &pBfShader, &pBfError, &_pDiffConstTable );
_lpD3DDevice->CreateVertexShader( (DWORD*)pBfShader->GetBufferPointer(), &_pDiffShader );
..........
if( FAILED(_pDiffConstTable->SetMatrix( pDevice, "mtrProj", &mtrProj )))
MessageBox( g_hWnd, "Set mtrProj Failed!!!", __FILE__, NULL );
if( FAILED(_pDiffConstTable->SetMatrix( pDevice, "mtrView", &mtrEye )))
MessageBox( g_hWnd, "Set mtrView Failed!!!", __FILE__, NULL );
.............
Shade.txt -------------------------------------------------------
extern matrix mtrProj;
extern matrix mtrView;
struct VS_INPUT
{
vector pos : POSITION;
vector diff : COLOR;
};
struct VS_OUTPUT
{
vector pos : POSITION;
vector diff : COLOR;
};
VS_OUTPUT Main( VS_INPUT input )
{
VS_OUTPUT output = (VS_OUTPUT)0;
..............
return output;
}
以上为主要代码, 执行_pDiffConstTable->SetMatrix( pDevice, "mtrView", &mtrEye )每次都失败....不知道是何原因, 哪位朋友能帮帮忙啊...谢谢 |
|