//开始创建顶点缓存
bool InitializeObjects() {
unsigned long color = D3DCOLOR_XRGB(100, 0, 0);
vertex ject[] = {
{100,200,0,1,color},
{200,200,0,1,color},
{300,200,0,1,color},
};
g_D3DDevice->CreateVertexBuffer( //创立静态顶点缓存
sizeof(ject),
D3DUSAGE_DYNAMIC,
D3DFVF_XYZ | D3DFVF_DIFFUSE,
D3DPOOL_MANAGED,
&dd,
0
);
void * str;
dd->Lock(0, sizeof(ject), (void**)&str, 0);
memcpy(str,ject,sizeof(ject));
dd->Unlock();
return true;
}
运行的时候只有黑屏,
我设置了个全局变量来控制清屏时背景颜色,
但就在这个函数里给全局变量赋值时失效了。