Hello everyone, i get a problem about render to texture.The problem is that i set the D3DXMatrixOrthoLH. hope render from (0,0) to (width,height), and i set the render target dimension as (a*width, a*height). Hope it will render the scene from (0,0,z) to (width,height,z) to a texture with dimension (a*width, a*height). But the texture doesn't just full fill the scene. below is some code:
//imaging this is the render result
|<-(a*width)->|
---------------
| | |
| | | a*height
| | |
|--------- |
| |
---------------
the result only render in the small square, not just the a*width and a*height;
//view
D3DXVECTOR3 vecEye(width/2.0f, height/2.0f, 0.0);
D3DXVECTOR3 vecLookAt(width/2.0f, height/2.0f, 1.0);
D3DXVECTOR3 vecUp(0.0f, 1.0f, 0.0f);
D3DXMatrixLookAtLH(&matView,&vecEye,&vecLookAt,&vecUp);
//prjection
D3DXMatrixOrthoLH(&matOrth, width, height, 0, 100);
pD3DDevice->SetTransform(D3DTS_WORLD, &matWorld);
pD3DDevice->SetTransform(D3DTS_VIEW, &matView);
pD3DDevice->SetTransform(D3DTS_PROJECTION, &matOrth);
//create the render target
pD3DDevice->CreateTexture(width*a,height*a,1,D3DUSAGE_RENDERTARGET, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &pD3DTexture, NULL);
pD3DTexture->GetSurfaceLevel(0, &pTextureSurface);
pD3DDevice->SetRenderTarget(0, pTextureSurface);
//render the scene
........
//save the texture data
.............
allien.