typedef struct
{
D3DXVECTOR4 p;
D3DXVECTOR2 t;
}
QUAD_VERTEX;
QUAD_VERTEX quad[4] =
{
{10.f, 10.f, 0.f, 1.f, 0.f, 0.f},
{74.f, 10.f, 0.f, 1.f, 1.f, 0.f},
{10.f, 74.f, 0.f, 1.f, 0.f, 1.f},
{74.f, 74.f, 0.f, 1.f, 1.f, 1.f}
};
pDevice->Clear (0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffff, 1.f, 0);
p_pd3dDevice->BeginScene();
pd3dDevice->SetFVF (D3DFVF_XYZRHW | D3DFVF_TEX1);
p_pd3dDevice->SetTexture (0, p_pTexture);
pd3dDevice->DrawPrimitiveUP (D3DPT_TRIANGLESTRIP, 2, quad, sizeof (QUAD_VERTEX));
p_pd3dDevice->EndScene();
p_pd3dDevice->Present (NULL, NULL, NULL, NULL);
struct textured_vertex{
float x, y, z, rhw; // The transformed(screen space) position for the vertex.
DWORD diffuse; // Our diffuse colour, which we'll only use for alpha
float tu,tv; // Texture coordinates
};
textured_vertex data[]={
{/*left pos*/thisWinX,/*bottom pos*/thisWinLength,1,1,0xFFFFFFFF,0,1},
{/*left pos*/thisWinX,/*top pos*/thisWinY,1,1,0xFFFFFFFF,0,0},
{/*right pos*/thisWinWidth,/*top pos*/thisWinY,1,1,0xFFFFFFFF,1,0},
{/*left pos*/thisWinX,/*bottom pos*/thisWinLength,1,1,0xFFFFFFFF,0,1},
{/*right pos*/thisWinWidth,/*top pos*/thisWinY,1,1,0xFFFFFFFF,1,0},
{/*right pos*/thisWinWidth,/*bottom pos*/thisWinLength,1,1,0xFFFFFFFF,1,1}
};
textured_vertex data[]={
{0, 0, 1, 1, 0xFFFFFFFF, 0, 1},
{0, 0, 1, 1, 0xFFFFFFFF, 0, 0},
{0, 0, 1, 1, 0xFFFFFFFF, 1, 0},
{0, 0, 1, 1, 0xFFFFFFFF, 1, 1}
};
p_pd3dDevice->BeginScene();
pd3dDevice->SetFVF (D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1);
p_pd3dDevice->SetTexture (0, p_pTexture);
for (numRow = 0; numRow < 4; ++numRow)
{
for (numCol = 0; numCol < 4; ++numRow)
{
data[0].x = 10 + numCol * 40;
data[0].y = 10 + numRow * 40;
data[1].x = data[0].x + 32;
data[1].y = data[0].y;
data[2].x = data[0].x;
data[2].y = data[0].y + 32;
data[3].x = data[0].x + 32;
data[3].y = data[0].y + 32;
d3dDevice->DrawPrimitiveUP (D3DPT_TRIANGLESTRIP, 2, data, sizeof (textured_vertex));
}
}
p_pd3dDevice->EndScene();
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
max float value | 3 | 26 | |
designing in object programming | 12 | 52 | |
Why does the Logic Pro Software instrument download gives me a .rar file: RAR ? | 8 | 32 | |
My package was sent to 28412, but I live in 28403, will it die? | 5 | 11 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
25 Experts available now in Live!