Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#Actualturch

Posted 28 June 2012 - 09:02 AM

I don't see your actual vertex coordinates, but if it draws correctly as a point list, then it's probably a culling issue. You don't say how you turned off culling before, but try inserting the following into your draw function, to make sure that there is no culling just before the draw call:

bool ST_Prim_Triangle::Draw()
{
	targetWindow->GetWindowDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);		   // this line
	targetWindow->GetWindowDevice()->SetStreamSource(0, vertex_object, 0, sizeof(D3DVERTEX));
	targetWindow->GetWindowDevice()->SetFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE);
	targetWindow->GetWindowDevice()->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);

	return true;
}


If that doesn't help, in PIX go to the end of a frame, select the color buffer window, right click on a pixel that is within the area the triangle should be drawn, and click "Debug Pixel". That should show each time the pixel shader was run, and if it failed the depth test, stencil test, etc.

#2turch

Posted 28 June 2012 - 09:00 AM

I don't see your actual vertex coordinates, but if it draws correctly as a point list, then it's probably a culling issue. You don't say how you turned off culling before, but try inserting the following into your draw function, to make sure that there is no culling just before the draw call:

bool ST_Prim_Triangle::Draw()
{
	targetWindow->GetWindowDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);		   // this line
	targetWindow->GetWindowDevice()->SetStreamSource(0, vertex_object, 0, sizeof(D3DVERTEX));
	targetWindow->GetWindowDevice()->SetFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE);
	targetWindow->GetWindowDevice()->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);

	return true;
}

#1turch

Posted 28 June 2012 - 08:57 AM

I don't see your actual vertex coordinates, but if it draws correctly as a point list, then it's probably a culling issue. Try inserting the following into your draw function:

bool ST_Prim_Triangle::Draw()
{
    targetWindow->GetWindowDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);		   // this line
    targetWindow->GetWindowDevice()->SetStreamSource(0, vertex_object, 0, sizeof(D3DVERTEX));
    targetWindow->GetWindowDevice()->SetFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE);
    targetWindow->GetWindowDevice()->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);

    return true;
}

If that works that means your vertices are in the wrong order. Either re-order the vertices or switch the culling mode during initialization.

PARTNERS