我正在尝试在 directx 中加载纹理以绘制带纹理的四边形。
但 D3DXCreateTextureFromFile 永远不会返回 D3D_OK ....
这是我加载纹理的代码....
FeralTexture(string Name,FeralVector2 Position,IDirect3DDevice9 *device)
{
FileName = Name;
m_pDevice = device;
x= Position.x;
y= Position.y;
if(D3DXCreateTextureFromFile(m_pDevice,FileName.c_str(),&m_pTextureFile) != D3D_OK)
{
TextureCreated = false;
m_pTextureFile = NULL;
D3DXCreateTextureFromFile(m_pDevice,FileName.c_str(),&m_pTextureFile);
}
else
{
if(D3DXGetImageInfoFromFile(FileName.c_str(),&ImageInfo) == D3D_OK)
{
TextureCreated = true;
Width = ImageInfo.Width;
Height = ImageInfo.Height;
MinVector = FeralVector2(x,y);
MaxVector = FeralVector2(x+Width,y+Height);
//BoundingRect = FeralRect2(MinVector,MaxVector);
}
else
{
Width = 0;
Height = 0;
}
}
}
我将图像的副本放在项目的调试文件夹和项目的主文件夹中......都不起作用......
任何输入将不胜感激....