8,324
社区成员
发帖
与我相关
我的任务
分享




// 使用了纹理的顶点结构
struct stD3DVertex
{
float x, y, z, rhw;
unsigned long color;
float tu, tv;
};
float fWidth=180.0/256;
float fHeight=390.0/512;
bool InitializeObjects()
{
// 将含有纹理坐标的数据填充到该顶点结构数组中
stD3DVertex objData[] =
{
{0, 390, 0.5, 1, D3DCOLOR_XRGB(255,255,255), 0, fHeight},
{180, 390, 0.5, 1, D3DCOLOR_XRGB(255,255,255), fWidth, fHeight},
{180, 0, 0.5, 1, D3DCOLOR_XRGB(255,255,255), fWidth, 0},
{180, 0, 0.5, 1, D3DCOLOR_XRGB(255,255,255), fWidth, 0},
{0, 0, 0.5, 1, D3DCOLOR_XRGB(255,255,255), 0, 0},
{0, 390, 0.5, 1, D3DCOLOR_XRGB(255,255,255), 0, fHeight}
};
// ,,,,
// 设置纹理采样模式(最近点采样)
//g_D3DDevice->SetSamplerState( 0, D3DSAMP_MIPFILTER, D3DTEXF_POINT);
g_D3DDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
g_D3DDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
// ...
}