• Advertisement
Sign in to follow this  

SetVertexShader...

This topic is 4765 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Has the meaning of set vertex shader changed between DirectX8 and DirectX9? I have some sample code which uses DirectX8 that seems to supply to SetVertexShader an FVF declaration. I thought that SetFVF would have been used? Here is the code:
g_pd3dDevice->SetVertexShader(Vertex::FVF_Flags);

// Vertex definition
struct Vertex
{
     FLOAT x, y, z;
     FLOAT tu, tv;

     enum FVF
     {
          FVF_Flags = D3DFVF_XYZ | D3DFVF_TEX1
     }
};

Thanks for any help guys. Mark Coleman

Share this post


Link to post
Share on other sites
Advertisement
Yes, it has changed.

In DX8 vertex shaders were referred to by a HANDLE value, which is what you passed to SetVertexShader(). As it was simply numerical D3D obviously had some way of figuring out if you passed it a shader handle or just an FVF code, which was also legal.

As of DX9 verex shaders are interface classes of their own, so SetVertexShader() takes a class pointer as it's parameter, thus no longer accepting FVF codes. To set an FVF code you have to now do this:

device->SetVertexShader(NULL);
device->SetFVF(fvfCode);

Which will then use the fixed function pipeline.

EDIT: as for you wondering why SetFVF() wouldn't have been used - well, it wasn't around in the days of DX8, it was introduced with DX9.

-Mezz

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement