Combining streams / vertex shaders (D3D8)

Started by
2 comments, last by risingdragon3 23 years, 2 months ago
According to the D3D8 doc''s, the normal FVF format setup will only use the first stream (0). So to combine 2 streams together, I have to create a vertex shader right? Any one know how to do this? I know I need to create a declaration, but do I need actual function code? ''Cos I''m only trying to combine the two. Thanks in advance ------------------------------ BCB DX Library - RAD C++ Game development for BCB
Advertisement
You can create a NULL vertex shader. This will use the fixed function pipeline. So it will combine the streams as specified in the declaration, but use the traditional transformation and lighting path.
So like this?
  DWORD Handle;DWORD Declaration[] = {    D3DVSD_STREAM( 0 ),    D3DVSD_REG( D3DVSDE_POSITION,  D3DVSDT_FLOAT3 ),    D3DVSD_REG( D3DVSDE_NORMAL,    D3DVSDT_FLOAT3 ),    D3DVSD_REG( D3DVSDE_TEXCOORD0, D3DVSDT_FLOAT2 ),    D3DVSD_END(),    D3DVSD_STREAM( 1 ),    D3DVSD_REG( D3DVSDE_DIFFUSE,   D3DVSDT_D3DCOLOR ),    D3DVSD_END()};Device->CreateVertexShader(Declaration,NULL,&Handle,0);Device->SetVertexShader(Handle);//... later onDevice->DeleteVertexShader(Handle);  

I haven''t tried it, as this PC doesn''t have a compiler, but I think it should work. Of course, I''ll complain here if it doesn''t

------------------------------
BCB DX Library - RAD C++ Game development for BCB
Ok, I tried it, it doesn''t work!
CreateVertexShader fails with the return code D3DERR_INVALIDCALL, or "The method call is invalid. For example, a method''s parameter may have an invalid value."
Any ideas?
It has to be the declaration, but I am doing that right, according to the doc''s. Oh yeah I tried to get rid of the middle D3DVSD_END(), but no effect.

------------------------------
BCB DX Library - RAD C++ Game development for BCB

This topic is closed to new replies.

Advertisement