Jump to content
  • Advertisement
Sign in to follow this  
theSonOfJecht

Texture Mapping Problem

This topic is 2914 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!