c++ directx 9 textute filtering error using IDirect3DDevice9
c++ directx 9 textute filtering error using IDirect3DDevice9::SetSamplerState
当我使用 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();
}
错误是 'IDirect3DDevice9::SetSamplerState':非法调用非静态成员函数 并且非静态成员引用必须相对于特定对象
您可能应该回顾一下C++面向对象编程的基础知识。
仅当SetSamplerState
是IDirect3DDevice9
类中的静态函数时,该语句才合法。
它不是,所以你需要使用:
gDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
由于您不熟悉 DirectX 编程,我强烈建议您学习 Direct3D 11 而不是传统的 Direct3D 9。互联网上有很多资源,包括用于DirectX 11的DirectX工具包。
相关文章:
- "error: no matching function for call to"构造函数错误
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- 使用 LuaBridge 将 LuaJIT 绑定到C++会导致"PANIC: unprotected error"
- OpenMP卸载说'fatal error: could not find accel/nvptx-none/mkoffload'
- "using namespace std;"在C++的作用是什么?
- C++错误:"error: int aaa::bbb is protected within this context"
- 尝试链接我的着色器时,我收到错误代码"error c5145 must write to gl_position"
- C++,在int数组中输入字符串或字符会输出0,而不是ascii或error
- 使用 cmake 的 LLVM 构建在 tsan_libdispatch_mac.cc 期间失败; "Error: conflicting types for ..."
- C++ "error: invalid use of void expression"
- struct.error:解压缩 C++ 结构时,解包需要 288 字节的缓冲区
- vector<vector<double>> to mxArray using memcpy
- 如何修复"error: ‘_1’ was not declared in this scope"?
- Using C++ CryptAPI:CNG Create CSR
- STLPort using C++11
- 函数中的 c++ using 语句,后跟函数名称(对于 ADL?
- Using getchar_unlocked()
- 类作用域的类型别名"using":[何时]方法中的用法可以先于类型别名?
- c++ directx 9 textute filtering error using IDirect3DDevice9
- 编译器报告:error: expected unqualified-id before ' using '