将图像加载到后台缓冲区 / direct3d / c++
这些是变量:
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
链接器让您知道它找不到函数 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.