c++ - 在 DirectX9 中将纹理寻址模式设置为边框颜色

标签 c++ directx texture-mapping directx-9

我试图在我的 DirectX 应用程序中将纹理寻址模式设置为边框颜色。根据this source 我所要做的就是:

call IDirect3DDevice7::SetTextureStageState and pass the texture stage identifier as the first argument, the D3DTSS_BORDERCOLOR stage state value as the second argument, and the desired RGBA border color as the third argument

我尝试使用以下代码:

m_device->SetTextureStageState(0, D3DTSS_BORDERCOLOR, 0);

但是我得到一个编译错误说

identifier "D3DTSS_BORDERCOLOR" is undefined

最佳答案

您确定要使用 DirectX7 吗?

你的文档太旧了,那是针对现在已经过时的DirectX7的,你应该在DirectX9中使用下面的函数

m_device->SetSamplerState(0, D3DSAMP_BORDERCOLOR, 0xffff0000) // red color

更新:

如果您没有设置正确的地址模式,这里是边界模式的代码。

m_device->SetSamplerState(0, D3DSAMP_ADDRESSU,  D3DTADDRESS_BORDER);
m_device->SetSamplerState(0, D3DSAMP_ADDRESSV,  D3DTADDRESS_BORDER);

关于c++ - 在 DirectX9 中将纹理寻址模式设置为边框颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24184831/

相关文章:

c++ - 如何逐步查看宏扩展?

c++ - Box2D - 我怎么知道 2 个固定装置何时接触?

c++ - 如何可靠地检查一个 Windows 进程是否是 C++ 中另一个进程的父进程?

c++ - 我怎样才能让这段代码播放波形文件更长时间?

c++ - 设置 DirectX9 表面像素

c++ - 在 C++ 中获取 opencv 错误

c++ - 如何设置二维窗口

opengl - 将立方体贴图的面渲染为四边形

c++ - OpenGL 纹理格式,为 OpenGL 创建图像/纹理数据

c++ - GL_QUADS 的 Opengl 纹理映射,得到奇怪的结果