Original Post
Hey, I'm trying to get into this whole shader business, but I'm confused.
All I want this one to do is set the diffuse color to green
// setup shader
DWORD dwDecl[] = {
D3DVSD_STREAM(0),
D3DVSD_REG(0, D3DVSDT_FLOAT3 ), //input register v0
D3DVSD_REG(5, D3DVSDT_D3DCOLOR ), // input register v5
D3DVSD_REG(7, D3DVSDT_FLOAT2 ), // input register v7
D3DVSD_REG(8, D3DVSDT_FLOAT2 ), // input register v7
D3DVSD_END()
};
// the vertices im using use(D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX2)
// set constants
FLOAT fMaterial[4] = {0,1,0,0};
d->SetVertexShaderConstant(5, fMaterial, 1);
// define shader
const char BasicVertexShader[] =
"vs.1.1 \n""mov oD0, c5 \n";
// create shader
ID3DXBuffer *pVs;
DWORD shader;
D3DXAssembleShader(BasicVertexShader, sizeof(BasicVertexShader) - 1, 0, NULL, &pVs, NULL);
d->CreateVertexShader(dwDecl, (DWORD*)pVs->GetBufferPointer(), &shader, 0 );
d->SetVertexShader( shader );
// end
I do all of that in the initialization function, if that helps.
It doesn't change a damn thing.
PS - there is a backslash in between the vs.1.1 and the mov instructions, but the forum erases it. Just so you know it's not that.
[edited by - Funkymunky on January 5, 2004 10:22:23 AM]