将图像加载到后台缓冲区 / direct3d / c++

发布于 2024-12-22 17:09:55 字数 1663 浏览 3 评论 0原文

这些是变量:

std::wstring        wsPath = L"./LIFE.bmp"; // path to the image
IDirect3DSurface9   *Surface = NULL;    // image surface
IDirect3DSurface9   *BackBuffer = NULL; // back buffer surface

这是 render() 函数:

void render(void)
{
    // Check to make sure you have a valid Direct3D device
    if (NULL == pd3dDevice) return;

    pd3dDevice -> Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 255), 1.0f, 0);   // clear the back buffer to a blue color

    if (SUCCEEDED(pd3dDevice -> BeginScene()))
    {
        D3DXIMAGE_INFO Info;

        D3DXGetImageInfoFromFile(wsPath.c_str(), &Info);
        pd3dDevice -> CreateOffscreenPlainSurface(Info.Width, Info.Height, Info.Format, D3DPOOL_SYSTEMMEM, &Surface, NULL);

        D3DXLoadSurfaceFromFile(Surface, NULL, NULL, wsPath.c_str(), NULL, D3DX_FILTER_NONE, 0, NULL);

        pd3dDevice -> GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &BackBuffer);
        pd3dDevice -> UpdateSurface(Surface, NULL, BackBuffer, NULL);

        // End the scene
        pd3dDevice -> EndScene();
    }

    // Present the back buffer contents to the display
    pd3dDevice -> Present(NULL, NULL, NULL, NULL);
}

我不断收到这个奇怪的错误:

1>DIRECTX_001.obj : error LNK2019: unresolved external symbol _D3DXLoadSurfaceFromFileW@32 referenced in function "void __cdecl render(void)" (?render@@YAXXZ)
1>DIRECTX_001.obj : error LNK2019: unresolved external symbol _D3DXGetImageInfoFromFileW@8 referenced in function "void __cdecl render(void)" (?render@@YAXXZ)

你能给我解释一下这里发生了什么吗?谢谢你!

these are the variables:

std::wstring        wsPath = L"./LIFE.bmp"; // path to the image
IDirect3DSurface9   *Surface = NULL;    // image surface
IDirect3DSurface9   *BackBuffer = NULL; // back buffer surface

and this is the render() function:

void render(void)
{
    // Check to make sure you have a valid Direct3D device
    if (NULL == pd3dDevice) return;

    pd3dDevice -> Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 255), 1.0f, 0);   // clear the back buffer to a blue color

    if (SUCCEEDED(pd3dDevice -> BeginScene()))
    {
        D3DXIMAGE_INFO Info;

        D3DXGetImageInfoFromFile(wsPath.c_str(), &Info);
        pd3dDevice -> CreateOffscreenPlainSurface(Info.Width, Info.Height, Info.Format, D3DPOOL_SYSTEMMEM, &Surface, NULL);

        D3DXLoadSurfaceFromFile(Surface, NULL, NULL, wsPath.c_str(), NULL, D3DX_FILTER_NONE, 0, NULL);

        pd3dDevice -> GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &BackBuffer);
        pd3dDevice -> UpdateSurface(Surface, NULL, BackBuffer, NULL);

        // End the scene
        pd3dDevice -> EndScene();
    }

    // Present the back buffer contents to the display
    pd3dDevice -> Present(NULL, NULL, NULL, NULL);
}

i keep getting this strange error:

1>DIRECTX_001.obj : error LNK2019: unresolved external symbol _D3DXLoadSurfaceFromFileW@32 referenced in function "void __cdecl render(void)" (?render@@YAXXZ)
1>DIRECTX_001.obj : error LNK2019: unresolved external symbol _D3DXGetImageInfoFromFileW@8 referenced in function "void __cdecl render(void)" (?render@@YAXXZ)

Can you explain to me what is happening here? Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

扮仙女 2024-12-29 17:09:55

链接器让您知道它找不到函数 D3DXLoadSurfaceFromFile 和 D3DXGetImageInfoFromFile。

检查链接器设置以确保包含所需的库。

有问题的库是 D3dx9.lib。

The linker is letting you know that it can't find the function D3DXLoadSurfaceFromFile and D3DXGetImageInfoFromFile.

Check your linker settings to make sure that you including the required libs.

The library in question is D3dx9.lib.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文