# D3DSAMP_MINFILTER darkening my texture?

## Recommended Posts

Ender1618    254
Using DirectX 9, I am having an odd behavior when i draw an image with a rhw rect to the back buffer. When drawing the textured screen rect with a size smaller than the original image size, it has the effect of darkening the texture. The texture I have is supplied by a live camera feed updating at ~25hz, so i didnt think i had the luxury of generating a mip chain (or is that really quick to generate?). When i have quartered the size of the rendered image from say 640x480 (the textures original res) to 320x240 the image is now shown completely black. What I have also noticed is that stretching the image does NOT seem to darken it, but compressing it does. I am guessing this has something to do with my use of the the texture sampling filters? What i really want is to draw a 640x480 image at the resolution of 512x768 (via compressing and stretching it), but it becomes significantly dimmer when I do this. Here is the code I am using to draw the image on the screen:
    pd3dDevice->SetRenderState( D3DRS_ZENABLE, FALSE);

pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );

pd3dDevice->SetTexture(0, m_pTexture->GetBaseInterface());
pd3dDevice->SetFVF(D3DFVF_PP_VERTEX);

pd3dDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST,0,4,2,
m_pIndices,D3DFMT_INDEX16,
m_pVertices,sizeof(PP_VERTEX));

pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE);


With:
struct PP_VERTEX
{
float x, y, z, rhw;
float tu, tv;       // Texcoord for post-process source
};

#define D3DFVF_PP_VERTEX (D3DFVF_XYZRHW|D3DFVF_TEX1)


Anyone know how I might avoid this? [Edited by - Ender1618 on February 15, 2010 1:29:17 PM]