Original Post
I'm trying to draw a full-screen, textured quad using the same method as the PostProcess sample that came with DX9SDK. My code must be missing something though, because whenever I run it all I get is the green/red flashing indicating that nothing is being drawn. What I have is:
struct PPVERT
{
float x, y, z, rhw;
float tu, tv; // Texcoord for post-process source
float tu2, tv2; // Texcoord for the original scene
const static D3DVERTEXELEMENT9 Decl[4];
};
const D3DVERTEXELEMENT9 PPVERT::Decl[4] =
{
{ 0, 0, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITIONT, 0 },
{ 0, 16, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },
{ 0, 24, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1 },
D3DDECL_END()
};
void DXViewport::RenderPostProcessQuad()
{
float width = GetViewportWidthPixels();
float height = GetViewportHeightPixels();
PPVERT quad[4] =
{
{ -0.5f, -0.5f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f },
{ width-0.5f, -0.5, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f },
{ -0.5, height-0.5f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f },
{ width-0.5f, height-0.5f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }
};
IDirect3DVertexDeclaration9* pVertDeclPP;
gpDXDevice->m_pDeviceLow->CreateVertexDeclaration( PPVERT::Decl, &pVertDeclPP );
gpDXDevice->m_pDeviceLow->SetVertexDeclaration( pVertDeclPP );
gpDXDevice->m_pDeviceLow->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, quad, sizeof(PPVERT));
SAFE_RELEASE(pVertDeclPP);
}
If I don't use RenderPostProcessQuad and instead use a function I made, it works but it's not accurate so I would rather use RenderPostProcessQuad. What am I missing? [Edited by - jaafit on April 5, 2006 11:38:58 AM]