new problem, model wont draw

(i did repost this on my previous topic but that kinda died, hoping this new topic will get a reply :), sorry if me posting two topics is a nuisance, but then it is two separate problems)

new problem!! D:, ive sorted most of the program out and figured out some of the stuff i didn't know before, but now i have a function to draw objects separately but it just draws a black screen, just wondered if anyone knows why this function isnt working:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
void drawObject(modelObject* obj)
{
	VOID* pVoid; // a void pointer
	// create a vertex buffer interface called v_buffer
	d3ddev->CreateVertexBuffer(obj->numVertices*sizeof(CUSTOMVERTEX), 0, 0, D3DPOOL_MANAGED, &v_buffer, NULL);

	
	// lock v_buffer and load the vertices into it
	v_buffer->Lock(0, 0, (void**)&pVoid, 0);
	memcpy(pVoid, obj->vertices, sizeof(obj->vertices));
	v_buffer->Unlock();

	// create a index buffer interface called i_buffer
	d3ddev->CreateIndexBuffer(obj->numVertices*sizeof(short), 0, D3DFMT_INDEX16, D3DPOOL_MANAGED, &i_buffer, NULL);
	// lock i_buffer and load the indices into it
	i_buffer->Lock(0, 0, (void**)&pVoid, 0);
	memcpy(pVoid, obj->indices, sizeof(obj->indices));
	i_buffer->Unlock();

	
	
	d3ddev->SetStreamSource(0, v_buffer, 0, sizeof(CUSTOMVERTEX));
	d3ddev->SetIndices(i_buffer);
	d3ddev->SetVertexDeclaration(Decl);
	// Begin passes.
	UINT numPasses = 0;
	mFX->Begin(&numPasses, 0);
	for(UINT i = 0; i < numPasses; i++)
	{	
		mFX->BeginPass(i);
		d3ddev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, obj->numVertices, 0, obj->numFaces);
		mFX->EndPass();
	}

	mFX->End();
}


im not fully sure how a lot of the mfx stuff works but yeah, not sure if im even drawing it right :/
Topic archived. No new replies allowed.