Sign in to follow this  
Trillian

SetSamplerState makes my app freeze

Recommended Posts

Trillian    410
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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this