Skip to main content
gamedev.net
🔒 Locked

Stream Error / Draw Primitive failed

Started by combatc2 0 replies 750+ views
Original Post
combatc2
combatc2
I'm trying to learn Vertex / Index buffers better since I don't understand them at all (any article suggestions would be appreciated). Anyways, I am trying to draw one triangle onto the screen and the Debugged output says (ERROR) : Stream 0 does not have required number of vertices (ERROR) : DrawPrimitive failed. Here's my three vertices and my calls

	Device->CreateVertexBuffer(3 * sizeof(Vertex), D3DUSAGE_WRITEONLY, FVF_VERTEX, D3DPOOL_MANAGED, &VB, 0);

	Vertex* v;
	VB->Lock(0, 0, (void**)&v, 0);

	v[0] = Vertex(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
	v[1] = Vertex(2.0f, 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
	v[2] = Vertex(-1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);

	VB->Unlock();

Device->SetStreamSource(0, VB, 0, sizeof(Vertex));
		Device->SetFVF(FVF_VERTEX);
		Device->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 3);


Thanks, Carl
Scet
Scet
Well in MDX the last parameter of Device.DrawPrimitives is the number of primitives so you might want to try:

Device->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);

Since you're drawing one triangle.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.