Texture Mapping Problem

Started by
1 comment, last by theSonOfJecht 13 years, 4 months ago
Hello
I have a trouble with texture mapping.
So please give me an advice.

This is the texture


BUT after drawing square polygon with this texture

pD3DDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );pD3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );pD3DDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_POINT );pD3DDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT );pD3DDevice->SetFVF(D3DFVF_XYZRHW| D3DFVF_TEX1);pD3DDevice->SetTexture( 0, m_pTex);float fLeftU = 0;float fTopV = 0;float fRightU = 1; float fBottomV = 1;pD3DDevice->GetRenderTarget(0, &pSurf);pSurf->GetDesc(&desc);pSurf->Release();FLOAT w = (FLOAT)desc.Width;FLOAT h = (FLOAT)desc.Height;typedef struct{float p[4]; float t[2];} SV;SV square[4] = {{0-0.5f, 0-0.5f, 0.5f, 1.0f, fLeftU, fTopV,},{w-0.5f, 0-0.5f, 0.5f, 1.0f, fRightU, fTopV,},{0-0.5f, h-0.5f, 0.5f, 1.0f, fLeftU, fBottomV,},{w-0.5f, h-0.5f, 0.5f, 1.0f, fRightU, fBottomV,},};pD3DDevice->SetRenderState(D3DRS_ZENABLE, FALSE); pD3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, svQuad, sizeof(SV));




it become like this.


My window size and the texture size are same.
So please tell me how to avoid this blurr effect at the edge.
In other words, how can I paste the texture without changeing its appearance?

Thanks
Advertisement
You need to disable texture filtering:

pD3DDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_NONE );pD3DDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_NONE );

You can read more about texture filtering here http://msdn.microsoft.com/en-us/library/bb206250%28v=vs.85%29.aspx
Thanks

I substutuite

pD3DDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_POINT );
pD3DDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT );
to

pD3DDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_NONE );
pD3DDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_NONE );

It improve the result.
HOWEVER, there is still blurr effects

This topic is closed to new replies.

Advertisement