Jump to content
  • Advertisement

Archived

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

monkey_face

some help with d3d...

This topic is 6021 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 have this code as my vertices: LVERTEX Vertices[] = { { -50.0f, 0.0f, 50.0f, 0.0f, 0.0f }, { -50.0f, 0.0f, -50.0f, 0.0f, 1.0f }, { 50.0f, 0.0f, -50.0f, 1.0f, 0.0f }, { 50.0f, 0.0f, 50.0f, 1.0f, 1.0f }, { -5.0f, 0.0f, 5.0f, 0.0f, 0.0f }, { -5.0f, 0.0f, -5.0f, 0.0f, 1.0f }, { -5.0f, 5.0f, 5.0f, 0.0f, 0.0f }, { -5.0f, 5.0f, -5.0f, 0.0f, 1.0f }, }; and this to draw them in my render function: g_pD3Ddevice->SetTexture(0, g_pTexture); g_pD3Ddevice->SetTextureStageState(0,D3DTSS_COLORARG1, D3DTA_TEXTURE); g_pD3Ddevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1); g_pD3Ddevice->SetStreamSource(0, g_pD3Dvb, sizeof(LVERTEX)); g_pD3Ddevice->SetVertexShader(D3DFVF_LVERTEX); g_pD3Ddevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 4); g_pD3Ddevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 5, 4); To me, it seems this should draw a "floor", (which it does), and a square face to the user''s "left". It sort of does this, but the square is off of the floor (further in the distance). If the floor extends to 50.0, and the square to only 5.0, shouldn''t the square be on the floor? Please someone help!

Share this post


Link to post
Share on other sites
Advertisement
I think that it should be this in the last line,
You need to change that 5 to a 4 because arrays are based at 0,
so the first four verticies are 0, 1, 2, 3 , you are skipping number four, and trying to render a quad from the 5, 6, 7 verticies,



g_pD3Ddevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 4, 4);


dankydoo

Share this post


Link to post
Share on other sites
i did change the parameter to 4, realizing i''d made a math mistake..but the result is still the same...the square is drawn off the "floor". can anyone help?

Share this post


Link to post
Share on other sites

  • 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!