8,304
社区成员
发帖
与我相关
我的任务
分享
D3DXIMAGE_INFO d3di_info;
D3DXGetImageInfoFromFile("xxxx.bmp", &d3di_info);
float width = d3di_info.Width;
float height = d3di_info.Height;
D3DXCreateTextureFromFileEx(
g_d3d_device,
"xxxx.bmp",
D3DX_DEFAULT,
D3DX_DEFAULT,
0U,
0UL,
D3DFMT_UNKNOWN,
D3DPOOL_MANAGED,
D3DX_FILTER_NONE,
D3DX_FILTER_NONE,
0UL,
NULL,
NULL,
&g_texture);
D3DSURFACE_DESC d3ds_desc;
g_texture->GetLevelDesc(0, &d3ds_desc);
VERTEX verts[] = {
{ 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f },
{ width, 0.0f, 1.0f, 1.0f, width / d3ds_desc.Width, 0.0f },
{ 0.0f, height, 1.0f, 1.0f, 0.0f, height / d3ds_desc.Height },
{ width, height, 1.0f, 1.0f, width / d3ds_desc.Width, height / d3ds_desc.Height }
};
g_d3d_device->CreateVertexBuffer(sizeof(VERTEX) * 4, 0, VERTEX_FVF, D3DPOOL_DEFAULT, &g_vertex_buffer, NULL);