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();
Title | # Comments | Views | Activity |
---|---|---|---|
FMX enumerated colours | 2 | 72 | |
Fibonacci challenge | 11 | 84 | |
Unresolved External Symbols | 3 | 53 | |
White board coding practice | 3 | 61 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
17 Experts available now in Live!