Category Archives: Techniques
Unresolved Externals
今天编译release version的程序时,碰到一堆这样的link error。
error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
查了半天才发现是VC的lib和Platform SDK的lib的兼容性问题,把Platform SDK里的libcp.lib删掉,就什么都好了。
Configure OpenGL
调整Matlab的显示精度
一个format函数就可以,后面可以加很多参数,比如:
format long
如果想改变数值的计算精度,可以使用:
vpa(x, n)
Perspectively-Correct Interpolation
感觉自己对graphics还是没有入门,很多graphics里的基本方法不能自然而然的应用到平时自己写得程序中,感觉没什么长进。比如以前的camera 的up,right vector,到现在的text mapping的方法,在visual hull里都有应用,可是自己还不知道,?
Happy New Year!
写好Sphere Map程序了
程序调了半天,最后发现是Reflective vector没有normalized的问题,导致最后结果莫名其妙。下面是在CG中用texture map的步骤:
To set a texture for a cg program you have to query the handle of the texture parameter via its name (CGparameter cgGetNamedParameter(CGprogram prog, const char * name)). Then you can use your texture created with OGL and attach it to the shader with cgGLSetTextureParameter(CGparameter handle_of_the_cg_texture_parameter, GLuint opengl_texture_id). To activate your texture that it is used with the program you have to call cgGLEnableTextureParameter(CGparameter handle_of_the_cg_texture_parameter). You can disable the texture with cgGLDisableTextureParameter(CGparameter handle_of_the_cg_texture_parameter).
If you don’t want to manage cgGLEnableTextureParameter/cgGLDisableTextureParameter calls and want them to be set automatically you can tell this cg with a call to cgGLSetManageTextureParameters(CGcontext ctx, CGbool flag) and flag set to CG_TRUE (it’s disabled by default). CG will the enable all textures attached to a certain program when you bind the program. To reset the texture state you should unbind the program again.
If you want to manage texture states all by yourself (via OpenGL calls) you can query for the texture stage you have to bind your texture to with a call to cgGLGetTextureEnum(CGparameter handle_of_the_cg_texture_parameter). It returns the proper GLenum that can be used to activate the correct texture stage with glActiveTexture.
Instead of querying the texture unit you can use a TEXUNITn semantic when you declare your uniform texture sampler in your cg program but there are some limitations when you want to compile to basic profiles.
-by someone
一个很不错的CG code网站:http://www.codesampler.com/oglsrc/oglsrc_10.htm。记得上次那个CG 程序就是看这个网站上的code才搞定的。
刚刚看了RayTracing的讲义
刚刚看了RayTracing的讲义,发现做PVH时困扰我两天的一个问题,原来ray retracing的slides里就有讲,搞得我很没脾气,看来自己学习太不认真了,上课不注意听,下课不复习,这可不行。
PVH还是动手快了
动手Implement前虽然paper都搞懂了(其实还有一些细节没搞懂),但是没有好好规划一下自己的代码如何写,为了赶deadline就草草的动手了。结果最终导致这一个星期的代码是基本上白写了,真是一个白痴。以前的经验教训都忘了,遇到事情还是不能冷静下来好好想想问题,还是容易受外界干扰。这下傻眼了,extended后的deadline看来还是赶不上了。
Anyway,现在无论如何也要停下来好好规划一下,不能再白痴了。。。
How to be a (sane) grad student (ZZ)
How to read papers
How to do research
How to choose a Ph.D topic
How to find an advisor
How to write papers that actually get accepted
How to prepare presentations
How to work in a healthy manner
How to work in a group
How to work with your advisor and other faculty members
How to deal with stress