Mental block on simple FVF stride problem

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

Recommended Posts

Hello, Here's a noob question! Direct3D9: (WARN) :Stream 0 stride and vertex size, computed from the current vertex declaration or FVF, are different, which might not work with pre-DX8 drivers This error is being output by my lens flare rendering code. Heres the relevant parts:
struct sFlareVertex
{
D3DXVECTOR2 Position;
float tU, tV;

const static DWORD FVF = D3DFVF_XYZ | D3DFVF_TEX1;
};

hr = g_device->CreateVertexBuffer(	4 * sizeof(sFlareVertex),
D3DUSAGE_WRITEONLY,
sFlareVertex::FVF,
D3DPOOL_DEFAULT,
&m_VB,
0);

g_device->SetFVF( sFlareVertex::FVF );
g_device->SetStreamSource(0, m_VB, 0, sizeof(sFlareVertex));
g_device->SetIndices( m_IB );

hr = g_device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 4, 0, 2 );


I can't for the life of me see why this generates the abouve errors. The stride seems okay to me :( I am right in thinking the effect file used can't generate this error? Thanks Simon

Share on other sites
D3DFVF_XYZ is a 3 component vector. You have a 2 component vector in your structure. 2*4 = 8. D3D is expecting a stride of 4 (4 for size of a float) more then what you give it

Share on other sites
omg... how embarrassing!

S