Archived

This topic is now archived and is closed to further replies.

texture problem

This topic is 5147 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

My texture with transparency is not showing up right. The side gets blured and theres a line up top. Heres a pic of what it looks like in game at left and the regular pic at right. pic these are render states used be4 rendering
d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE , TRUE);
    d3dDevice->SetRenderState(D3DRS_SRCBLEND,  D3DBLEND_SRCALPHA);
    d3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
	

	d3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_SELECTARG1 );
    d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
    d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP,   D3DTOP_SELECTARG1 );
    d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
    d3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_NONE );
    d3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_NONE );
    d3dDevice->SetSamplerState( 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE );
    d3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSU,  D3DTADDRESS_CLAMP );
    d3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSV,  D3DTADDRESS_CLAMP );
 
[edited by - jellyhead on November 12, 2003 10:25:36 PM]

Share this post


Link to post
Share on other sites
This is what i use to load my picture
D3DXCreateTextureFromFile(d3dDevice, "i/cursor.png", &tCursor)

Theres no scaling, im using this texture on a 15*15 quad using xyzrhw vertices so it should be just that size.

Share this post


Link to post
Share on other sites
try setting D3DTEXF_POINT instead of D3DTEXF_NONE
that should tur off ''antialiasing''

d3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_POINT );
d3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
d3dDevice->SetSamplerState( 0, D3DSAMP_MIPFILTER, D3DTEXF_POINT);

Share this post


Link to post
Share on other sites
I seem to have solved my problem. I changed the texture size from 15*15 to 16*16 and no more filtering occured. From what i''ve tested the texture needs to be in powers of 2 so it doesnt get filtered. I dont understand this, dont modern cards support textures not in powers of 2? Is this normal or is it my card. Im using a gforce ti 4200.

Share this post


Link to post
Share on other sites
Most modern cards handle Non-Pow2 in certain cases, but not in the general case which is what D3DXCreateTexture has to deal with.

Read the docs on the D3DPTEXTURECAPS_NONPOW2CONDITIONAL cap, it explains when it can use Non-Power2 textures. And of course you have to test the Caps for the presence of that bit.


Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites