#### Archived

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

# Having problems with my translation matrix

This topic is 5309 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I''m trying to make a pnog type game with DX8 and I''m having trouble trying to get the paddle to move using a Translation Matrix. The paddle will draw fine but if I try to move it ti will disapper from the screen. The code seems fairly straight forward enough:
void TexturedQuad::Move(float x, float y)
{
D3DXMATRIX matTranslation, matIdentity;

d3dd->SetStreamSource(0, pVertBuffer, sizeof(Vertex));

D3DXMatrixTranslation(&matTranslation, x, y, 0.0f);
D3DXMatrixIdentity(&matIdentity);
D3DXMatrixMultiply(&matIdentity, &matIdentity, &matTranslation);

d3dd->ProcessVertices(0, 0, 4, pVertBuffer, D3DFVF_MYVERTEX);
}


Could the problem be that I''m using the same buffer for the stream source and destination buffer? Any help is appreciated.

##### Share on other sites
That code you''ve posted is very odd. Here''s a list of things you need to address:

1) Why are you creating an identity matrix?

2) Why are you multiplying the translation matrix by the identity matrix?

4) I have no idea why you''re using ProcessVertices, but what the heck... The destination vertex buffer for ProcessVertices must contain transformed vertices (i.e. the FVF must contain D3DFVF_XYZRHW). The source vertex buffer for ProcessVertices must contain untransformed vertices (i.e. D3DFVF_XYZ). By this requirement alone, your call to ProcessVertices is surely failing. You''d know that if you bothered to look at the return value from the API, or the debug messages output by the debug D3D runtime.

5) Why are you passing D3DFVF_MYVERTEX as the Flags parameter to ProcessVertices? The Flags parameter may either be 0, or D3DPV_DONOTCOPYDATA. This should also cause ProcessVertices to fail.

Good luck!

1. 1
2. 2
Rutin
26
3. 3
4. 4
JoeJ
18
5. 5
gaxio
11

• 14
• 22
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631763
• Total Posts
3002197
×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!