Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.
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 |
---|---|---|---|
Can This PC Run OverWatch | 7 | 96 | |
Add values of each row in an array | 3 | 56 | |
show out valin of json for debugging in visaul c++ | 1 | 31 | |
Embarcadero C++ builder XE10.1 Berlin find In files dialogue stunted display | 4 | 31 |
Join the community of 500,000 technology professionals and ask your questions.