Effect-Compiler Tool(fxc.exe)

摘要: 提前编译shader文件,提高运行时的效率。refer to http://msdn.microsoft.com/en-us/library/windows/desktop/bb509710%28v=vs.85%29.aspx编译后的使用,跟之前的代码 一样,直接调用compileFromFile或者compileFromResource使用。 阅读全文
posted @ 2013-08-01 12:48 不吃鱼的猫 阅读(608) 评论(0) 推荐(0) 编辑

ATL ActiveX 非管理员权限发布(支持vs2005)

摘要: 在win7系统中,vs2005开发的atl activex需要管理员权限才能注册。解决方法:PerUserRegistration.h#pragma onceclass PerUserRegistration{public: PerUserRegistration(bool perUser = true); ~PerUserRegistration();private:#if _ATL_VER #include PerUserRegistration::PerUserRegistration(bool perUser)#if _ATL_VER = 0900 AtlSetPer... 阅读全文
posted @ 2013-07-30 12:28 不吃鱼的猫 阅读(750) 评论(0) 推荐(0) 编辑

linearizing the depth in vertex shader

摘要: please refer to http://www.mvps.org/directx/articles/linear_z/linearz.htmWhen using a programmable vertex shader, we have direct control of the transformation process, and can implement our own. Vertex position can be read from the input registers, manipulated however we like, then output as a 4D ho 阅读全文
posted @ 2013-07-11 13:07 不吃鱼的猫 阅读(341) 评论(0) 推荐(0) 编辑

Normal Vector Using WorldInverseTranspose

摘要: shader里面经常看到normal向量是用WorldInverseTranspose矩阵做变换的,有时候也可以用WorldMatrix变换。原理:If your object is only ever rotated and translated, you can transform normal... 阅读全文
posted @ 2013-07-08 18:48 不吃鱼的猫 阅读(892) 评论(0) 推荐(0) 编辑

gpu的float精度

摘要: 原本想把渲染过程中的坐标转换放到gpu中运算,结果发现精度不够,以后要注意。总结一下渲染过程中的精度问题:1. 所有不需要提交到d3d渲染的数据,都用double参与计算,存储,最后在转换成float传递给gpu2. 对传递到gpu的float数据,要保证其能满足当前的绘制精度,具体实现用相对坐标系来渲染保证足够的精度,避免抖动问题 阅读全文
posted @ 2013-06-14 13:51 不吃鱼的猫 阅读(618) 评论(0) 推荐(0) 编辑

IID_ID3DXEffectStateManager链接错误

摘要: 很奇怪明明链接了lib文件,仍然报错。查找报错的iid发现使用宏DEFINE_GUID,在查找宏,发现#ifdef INITGUID#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ EXTERN_C const GUID DECLSPEC_SELECTANY name \ = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }#else#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, 阅读全文
posted @ 2013-06-13 13:17 不吃鱼的猫 阅读(345) 评论(0) 推荐(0) 编辑

Invalidate函数及WM_PAINT总结

摘要: (转自百度文库 + 个人一点看法)InvalidateRect只是增加重绘区域,在下次WM_PAINT的时候才生效InvalidateRect函数中的参数TRUE表示系统会在你画之前用背景色将所选区域覆盖一次,默认背景色为白色,可以通过设置BRUSH来改变背景色。Invalidate()之后:(MFC的,顺便了)OnPaint()->OnPrepareDC()->OnDraw()所以只是刷新在OnPaint()和OnDraw()函数中的绘图语句。其它地方没有影响。Invalidate标记一个需要重绘的无效区域,并不意味着调用该函数后就立刻进行重绘。类似于PostMessage(WM 阅读全文
posted @ 2013-06-05 13:12 不吃鱼的猫 阅读(295) 评论(0) 推荐(0) 编辑

三维模型的渲染效率

摘要: 有几个点,可以考虑提高三维模型的实时显示效率。1. 改变渲染顺序,基本的是node->mesh->material,可以改成material优先或者mesh优先,视具体情况定。2. 为所以的mesh建立lod暂时只想了这么多 阅读全文
posted @ 2013-05-30 13:27 不吃鱼的猫 阅读(403) 评论(0) 推荐(0) 编辑

编译STL的效率问题

摘要: 程序中如果大量使用stl,效率低下,可以在项目预处理宏里面添加_HAS_ITERATOR_DEBUGGING=0_SECURE_SCL=0 阅读全文
posted @ 2013-05-29 15:53 不吃鱼的猫 阅读(473) 评论(4) 推荐(0) 编辑