Original Post
Hi,
I have an problem with my blitting routine! I have made this screenshots, the first is a screenshot from my programm and the second is the BitmapFile who I try to blit.
http://cpp.ufosnetwork.com/Image1.gif
http://cpp.ufosnetwork.com/Image2.gif
my routine:
please help me!
---------------------------------------
Coden ist das Schönste auf der Welt!
[edited by - Hamster Patrick on June 2, 2002 4:03:00 AM]
[edited by - Hamster Patrick on June 2, 2002 4:03:58 AM]
[edited by - jim adams on June 2, 2002 2:21:35 PM]
bool CGraphic::drawAdvance (float x, float y, float rotation, D3DCOLOR color, CVideo &PrimaryVideoClass)
{
VERTEX v1,v2,v3,v4;
VERTEX Vertex_Array[4];
D3DXMATRIX matRot, matTrans, matTrans2, matWorld;
float Breite = (float)m_ImageInfo.Width;
float Hoehe = (float)m_ImageInfo.Height;
v1.x = x;
v1.y = y;
v1.z = 0.5f;
v1.u = 0.0f;
v1.v = 0.0f;
v1.color = color;
v2.x = Breite + x;
v2.y = y;
v2.z = 0.5f;
v2.u = 1.0f;
v2.v = 0.0f;
v2.color = color;
v3.x = x;
v3.y = Hoehe + y;
v3.z = 0.5f;
v3.u = 0.0f;
v3.v = 1.0f;
v3.color = color;
v4.x = Breite + x;
v4.y = Hoehe + y;
v4.z = 0.5f;
v4.u = 1.0f;
v4.v = 1.0f;
v4.color = color;
Vertex_Array[0] = v2;
Vertex_Array[1] = v1;
Vertex_Array[2] = v4;
Vertex_Array[3] = v3;
D3DXMatrixRotationZ(&matRot, PI * rotation / 180);
PrimaryVideoClass.getDevice()->SetTransform(D3DTS_WORLD, &matRot);
D3DXMatrixTranslation(&matTrans,-x-(Breite/2),-y-(Hoehe/2), 0.0f);
D3DXMatrixTranslation(&matTrans2,x+(Breite/2),y+(Hoehe/2), 0.0f);
D3DXMatrixMultiply(&matWorld, &matTrans, &matRot);
D3DXMatrixMultiply(&matWorld, &matWorld, &matTrans2);
PrimaryVideoClass.getDevice()->SetTransform(D3DTS_WORLD, &matWorld);
PrimaryVideoClass.getDevice()->SetTexture(0, m_Texture);
PrimaryVideoClass.getDevice()->SetTextureStageState(0, D3DTSS_MINFILTER, D3DTEXF_LINEAR);
PrimaryVideoClass.getDevice()->SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR);
PrimaryVideoClass.getDevice()->SetTransform(D3DTS_PROJECTION, &PrimaryVideoClass.matProj);
PrimaryVideoClass.getDevice()->SetVertexShader(VERTEXCAPS);
PrimaryVideoClass.getDevice()->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,&Vertex_Array[0],sizeof(VERTEX));
D3DXMatrixMultiply(&matWorld, &matWorld, &matTrans2);
D3DXMatrixRotationZ (&matWorld, 0);
PrimaryVideoClass.getDevice()->SetTransform(D3DTS_WORLD, &matWorld);
return (true);
}