Original Post
Hi all ,
I have an interesting problem regarding the single quad I am using for my post processing :
The single quad I render is just covers top half of the screen as in links below :
Original Broken
That is how I create and render it :
That it the simple shader , as there is no transformations in vertex shaders :
I have an interesting problem regarding the single quad I am using for my post processing :
The single quad I render is just covers top half of the screen as in links below :
Original Broken
That is how I create and render it :
...
ID3DXMesh* PPQuadMesh;
struct VertexPostProcess
{
VECTOR3 m_translation;
float u;
float v;
VertexPostProcess(float x, float y, float z, float tu, float tv)
{
m_translation.x = x;
m_translation.y = y;
m_translation.z = z;
u = tu;
v = tv;
}
};
#define VERTEXPOSTPROCESS_FVF (D3DFVF_XYZ | D3DFVF_TEX1 )
#define VERTEXPOSTPROCESS_FVF_SIZE D3DXGetFVFVertexSize( VERTEXPOSTPROCESS_FVF )
...
void CreateQuad()
{
D3DXCreateMeshFVF(2, 4, D3DXMESH_MANAGED, VERTEXPOSTPROCESS_FVF, m_graphicsDevice, &PPQuadMesh);
VertexPostProcess* v = 0;
PPQuadMesh->LockVertexBuffer(0, (void**)&v);
v[0] = VertexPostProcess( -1.0f, -1.0f, 1.0f, 0.0f, 1.0f);
v[1] = VertexPostProcess( -1.0f, 1.0f, 1.0f, 0.0f, 0.0f);
v[2] = VertexPostProcess( 1.0f, 1.0f, 1.0f, 1.0f, 0.0f);
v[3] = VertexPostProcess( 1.0f, -1.0f, 1.0f, 1.0f, 1.0f);
PPQuadMesh->UnlockVertexBuffer();
WORD* i = 0;
PPQuadMesh->LockIndexBuffer(0, (void**)&i);
i[0] = 0; i[1] = 1; i[2] = 2;
i[3] = 0; i[4] = 2; i[5] = 3;
PPQuadMesh->UnlockIndexBuffer();
std::vector<DWORD> adjacencyBuffer(PPQuadMesh->GetNumFaces() * 3);
PPQuadMesh->GenerateAdjacency(0, &adjacencyBuffer[0]);
}
void Render()
{
m_effect.SetTexture("diffuseTexture",m_texture);
unsigned int nPass ;
m_effect->BeginRender(&nPass);
for(int i = 0 ;i<nPass;i++)
{
m_effect.BeginPass(i);
PPQuadMesh->DrawSubset(0);
m_effect->EndPass();
}
m_effect->EndRender();
}
That it the simple shader , as there is no transformations in vertex shaders :
texture diffuseTexture;
sampler ColorSampler = sampler_state
{
Texture = <diffuseTexture>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = LINEAR;
};
struct A2V
{
float4 Position : POSITION;
float2 TexCoord : TEXCOORD0;
};
struct V2P
{
float4 Position : POSITION;
float2 TexCoord : TEXCOORD0;
};
void VS(in A2V IN, out V2P OUT)
{
OUT.Position = IN.Position;
OUT.TexCoord = IN.TexCoord;
}
float4 PSScene(in V2P IN) : COLOR0
{
return tex2D(ColorSampler, IN.TexCoord);
}
technique Scene
{
pass Pass0
{
VertexShader = compile vs_2_0 VS();
PixelShader = compile ps_2_0 PSScene();
}
}