• Advertisement


This topic is now archived and is closed to further replies.

D3D: work this out....HELP

This topic is 5998 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

In my code I render a index buffer and thats all, my problem is Nothing is diplayed unless I use a DrawPrimitive on the vertices before calling the DrawIndexedPrimitive. I assume I have fogotten do something which Draw primitive is doing for me...but what. I REALLY want (read NEED) to get rid of the DrawPrimitive call. (see the line with comments below) PLEASE HELP!!! Cheers X2K
lpD3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
lpD3DDevice->SetStreamSource(0, lpVB, sizeof(bsp_vertex));

D3DUtil_InitMaterial(mat, 1.0f, 1.0f, 1.0f, 1.0f);

for (int f=0; f<face_count; f++) {
	lpD3DDevice->SetTexture(0, lpTextures[faces[f].texture]);
	lpD3DDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
	lpD3DDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
	lpD3DDevice->SetIndices(lpIB, faces[f].start_vertex);

// If this line is here it works otherwise the screen is bank
	lpD3DDevice->DrawPrimitive(D3DPT_POINTLIST, faces[f].start_vertex, faces[f].vertex_count);

	lpD3DDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0,
	       faces[f].vertex_count, faces[f].start_element, faces[f].element_count/3);
Edited by - xstreme2000 on November 14, 2001 4:45:07 PM

Share this post

Link to post
Share on other sites
Try doing as follows:


hr = lpD3DDevice->DrawIndexedPrimitive(...);
//(...) is the parameter list
then you have to write
if (hr == D3D_OK){
//do something
//show a message box indicating the error code, that will be

Share this post

Link to post
Share on other sites
I feel my explanation isn''t too good so I''ll explain properly. If I execute the code with just the DrawPrimitive call I get all my vertices drawn as dots, if I execute it with both the DrawPrimitive & DrawIndexedPrimitive calls I get a nice rendered level with textures, but when I execute with only the DrawIndexedPrimitive call I get nothing!!!

In all cases all functions return successfully!

It would seem that the DrawPrimitive call is selecting/enabling something which I have fogotten to do.


Cheers Tom

Share this post

Link to post
Share on other sites
Tomorrow I''m going to try recreating all resource. If that cures it, it''s a bug in the SDK - which I doubt...only DEFAULT resources should need recreating on Reset()...

I''ll let u know how I get on...


Share this post

Link to post
Share on other sites

  • Advertisement