D3DXCreateTextureFromResource访问冲突

时间:2017-09-18 18:28:06

标签: c++ directx c++14 direct3d

D3DXCreateTextureFromResource有时会导致用户访问冲突。我无法调试它,因为它永远不会发生在我身上。

bool LoadTexture(LPDIRECT3DTEXTURE9* texture, IDirect3DDevice9* pDevice, int resourceID)
{

    HRESULT hr = D3DXCreateTextureFromResource(pDevice, dll, MAKEINTRESOURCE(resourceID), texture);
    if (hr != D3D_OK)
    {
        char errorBuf[256];
        sprintf(errorBuf, "Error loading texture! Errorcode: %i", hr);
        MessageBoxA(NULL, errorBuf, "Error", MB_OK);
        return false;
    }
    return true;
}

0 个答案:

没有答案