SetSamplerState makes my app freeze

Started by
1 comment, last by Trillian 18 years, 4 months ago
Hi! I have a Texture class designed to handle texture loading/managing operations. It stocks the Texture, Filter types, the filename and optionnally an ID. All the codes works well and renders execept this:

void D3DY::CD3DYTexture::SelectTexture(LPDIRECT3DDEVICE9 const Device,int iTexNum)
{
	if(iTexNum<0) return;
	Device->SetTexture(iTexNum,m_pTexture);

	Device->SetSamplerState(iTexNum,D3DSAMP_MAGFILTER,m_TexFilter);
	Device->SetSamplerState(iTexNum,D3DSAMP_MINFILTER,m_TexFilter);
	Device->SetSamplerState(iTexNum,D3DSAMP_MIPFILTER,m_MipFilter);
}


Unless I comment out the SetSamplerState functions, my app makes an error at this moment. That is, right after the SetTexture which works. What can be the cause of this? Does calling SetSamplerState between beginscene and endscene result in a bug? oh, and m_TexFilter and m_MipFilter are defined like so: D3DTEXTUREFILTERTYPE m_TexFilter, m_MipFilter; Which, in my program, corresponds to D3DTEXF_LINEAR and D3DTEXF_LINEAR
Advertisement
The easiest way to figure out what you are doing wrong will be to Enable D3D Debugging and check the Output from the debug runtime. It will tell you exactly what you are doing wrong in this situation.

As a general rule, if you get an INVALID_CALL error, fire up the debugger and check out the D3D output.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
Oh I see!

Thanks for the advice, I should have done this first.

I get an error like so:

First-chance exception at 0x77e55a3d in Debug.exe: 0xC0000005: Access violation reading location 0x03e4eb80.
Direct3D9: (ERROR) :Invalid texture pointer. SetTexture failed.

0x03e4eb80 corresponds to my texture pointer's value.

I'll investigate on the case

This topic is closed to new replies.

Advertisement