Mental block on simple FVF stride problem

Started by
1 comment, last by sipickles 17 years, 11 months ago
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 );

                /// shader constant code here....

                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
Advertisement
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
[size=2]aliak.net
omg... how embarrassing!

S

This topic is closed to new replies.

Advertisement