-1

i have a issue when i use IDirect3DDevice9::SetSamplerState

void Draw(GraphicsDevice *gDevice, float gameTime)
{
    // here's the problem
    IDirect3DDevice9::SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
    //Simple RGB value for the background so use XRGB instead of ARGB
    gDevice->Clear(D3DCOLOR_XRGB(0, 100, 100));
    gDevice->begin();

    //Draw logic here.
    if (sprite && sprite->IsInitialized()) sprite->Draw(gameTime);
    gDevice->end();
    gDevice->present();
}

the errors is 'IDirect3DDevice9::SetSamplerState': illegal call of non-static member function and a nonstatic member reference must be relative to a specific object

alabdaly891
  • 159
  • 1
  • 8

1 Answers1

1

You should probably review the basics of C++ object-oriented programming.

That statement is only legal if SetSamplerState is a static function in the IDirect3DDevice9 class.

It's not, so you need to use:

gDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_NONE);

As you are new to DirectX programming, I strong recommend you learn Direct3D 11 instead of legacy Direct3D 9. There are plenty of resources on the Internet, including the DirectX Tool Kit for DirectX 11.

Chuck Walbourn
  • 38,259
  • 2
  • 58
  • 81
  • i just started learn direct3D 9 and i can't use direct3D 11 because my gpu is 10.1 directx – alabdaly891 Sep 19 '19 at 23:46
  • and i used IDirect3DDevice9::SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_NONE); because that's what i found in microsoft docs – alabdaly891 Sep 19 '19 at 23:47
  • Direct3D 11 (the API) will work with basically all Shader Model 2.0 or better video hardware including ``D3D_FEATURE_LEVEL_10_1`` like your GPU. See [Direct3D Feature Levels](https://walbourn.github.io/direct3d-feature-levels/). – Chuck Walbourn Sep 20 '19 at 19:14