directx_jun10在VS2010下的配置
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
directx_jun10在VS2010下的配置
1、打开VS2010,新建控制台应用程序项目dx,如图:
2、右击dx,选择属性:
分别在VC++目录中的可执行文件、包含目录和库目录中添加(其中D:\Program Files (x86)\dxsdk_JUN10为安装dxsdk_jun10的安装路径):
可执行文件:
D:\Program Files (x86)\dxsdk_JUN10\Utilities/Bin/x86;
包含目录:
D:\Program Files (x86)\dxsdk_JUN10\Include;
库目录:
D:\Program Files (x86)\dxsdk_JUN10\Lib/x86;
3、选择连接器中的输入:
正确链接所需要的lib文件,在”附加依赖项“那里添加:
d3dx9d.lib;
d3dx10d.lib;
d3d9.lib;
winmm.lib;
如果仍有链接问题,可能还缺少其他的lib文件,注意添加。4、实例验证
右击源文件,添加新建项dx.cpp:
将实例黏贴到dx.cpp中,F5运行即可:
#include
#include
usingnamespace std;
// Overload the "<<" operators so that we can use cout to // output D3DXVECTOR3 objects.
ostream&operator<<(ostream& os, D3DXVECTOR3&v)
{
os <<"("<< v.x <<", "<< v.y <<", "<< v.z <<")";
return os;
}
int main()
{
// Using constructor, D3DXVECTOR3(FLOAT x, FLOAT y, FLOAT z);
D3DXVECTOR3 u(1.0f, 2.0f, 3.0f);
// Using constructor, D3DXVECTOR3(CONST FLOAT *);
float x[3] = {-2.0f, 1.0f, -3.0f};
D3DXVECTOR3 v(x);
// Using constructor, D3DXVECTOR3() {};
D3DXVECTOR3 a, b, c, d, e;
// Vector addition: D3DXVECTOR3 operator +
a = u + v;
// Vector subtraction: D3DXVECTOR3 operator -
b = u - v;
// Scalar multiplication: D3DXVECTOR3 operator*
c = u * 10;
// ||u||
float L = D3DXVec3Length(&u);
//d = u / ||u||
D3DXVec3Normalize(&d, &u);
// s = u dotv
float s = D3DXVec3Dot(&u, &v);
// e = u xv
D3DXVec3Cross(&e, &u, &v);
cout <<"u = "<< u << endl;
cout <<"v = "<< v << endl;
cout <<"a = u + v = "<< a << endl;
cout <<"b = u - v = "<< b << endl;
cout <<"c = u * 10 = "<< c << endl;
cout <<"d = u / ||u|| = "<< d << endl;
cout <<"e = u x v = "<< e << endl;
cout <<"L = ||u|| = "<< L << endl;
cout <<"s = u.v = "<< s << endl;
return 0;
}
运行结果:
配置完成!