some help with d3d...

Started by
2 comments, last by monkey_face 22 years, 3 months ago
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!
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
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?
I dunno, I would interested to see tho!

http://www.geocities.com/streampark - WayOut Engine v00.2
''That''s it man, game over man, game over'' - Aliens
brb

This topic is closed to new replies.

Advertisement