Jump to content
  • Advertisement
Sign in to follow this  
eugene2k

Direct3D 9 and RHW vertices

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

I'm trying to draw a triangle inside a Direct3D9 window that belongs to another program. Athough everything seems to be ok, and all of the functions return without errors, the triangle doesn't get drawn. I'm puzzled: what could be the reason it's not getting drawn? P.S. I do the drawing by intercepting Present, and the hook is called, as is evident inside the debugger, the triangle should not be clipped since it is inside the window boundaries. Everything works fine in my test application.

Share this post


Link to post
Share on other sites
Advertisement
Mind posting the code you use for drawing the triangle?

Share this post


Link to post
Share on other sites
I forget if hooking conflicts with PIX, but you could try stepping through the call-stream to see the intermediary frame states to get more insight...

Also, are you using MH's D3D Hooking sample? If so, compare your code to his and see what you're doing differently.

hth
Jack

Share this post


Link to post
Share on other sites
I've just checked MH's hooking example - it doesn't work either. Will check the PIX tool now :)

Currently I'm using this code (It's not really RHW anymore, since I'm transforming the vertices, but it's the same thing, AFAIK. I'm using an orthographic projection matrix for camera and identity matrices for world and view)

pDevice->GetTransform(D3DTS_VIEW,&mOldView);
pDevice->GetTransform(D3DTS_PROJECTION,&mOldProject);
pDevice->GetTransform(D3DTS_WORLD,&mOldWorld);

pDevice->SetTransform(D3DTS_VIEW,&mView);
pDevice->SetTransform(D3DTS_PROJECTION,&mProject);
pDevice->SetTransform(D3DTS_WORLD,&mWorld);

pDevice->SetRenderState(D3DRS_ZENABLE,D3DZB_FALSE);
if (pDevice->BeginScene()==0)
{
pDevice->SetStreamSource( 0, pVB, 0, sizeof(CUSTOMVERTEX) );
pDevice->SetFVF( D3DFVF_CUSTOMVERTEX );
pDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, 1 );
}
pDevice->EndScene();
pDevice->SetRenderState(D3DRS_ZENABLE,D3DZB_TRUE);

pDevice->SetTransform(D3DTS_VIEW,&mOldView);
pDevice->SetTransform(D3DTS_PROJECTION,&mOldProject);
pDevice->SetTransform(D3DTS_WORLD,&mOldWorld);

Share this post


Link to post
Share on other sites
What's your vertices look like? Are they clockwise or counter-clockwise? If the app has backface culling enabled (SetRenderState with D3DRS_CULLMODE and a value of D3DCULL_CCW) and your vertices are counter-clockwise, they won't be drawn.

Share this post


Link to post
Share on other sites
Yeah, I noticed the problem with culling after posting. Culling is now disabled, the triangle is still not getting drawn.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!