Category Archives: Techniques

IBVH有初始结果了

写了好长好长时间,中间老板还和我一起debug了好几次,今天终于有个小结果了。左边那幅图像是使用8个reference images,右边那个使用5个reference images。不过程序运行速度很慢,用release version的程序,大概还跑了5-10分钟(根据使用的reference images的不同),接下来准备用VTune调调,看看程序到底哪部分的运行时间过程,哪部分代码的运行次数最多,优化一下。

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

最近又重装了系统,调程序的时候发现Opengl没有了,就又装了一遍,把整个过程写下来,省得以后忘了。
1. Copy glut32.lib and glut.def to C:\Program Files\Microsoft Platform SDK\Lib
2. Copy glut.h to C:\Program Files\Microsoft Platform SDK\Include\gl
3. Copy glut32.dll to C:\WINDOWS\system
4. Revise glut.h,  otherwise you will meet the error "c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\stdlib.h(251): error C2381: ‘exit’ : redefinition; __declspec(noreturn) differs"
    #if defined(_WIN32)
    # ifndef GLUT_BUILDING_LIB
    /*extern _CRTIMP void __cdecl exit(int);*/
    _CRTIMP __declspec(noreturn) void __cdecl exit(int);
    # endif

写好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才搞定的。

PVH还是动手快了

动手Implement前虽然paper都搞懂了(其实还有一些细节没搞懂),但是没有好好规划一下自己的代码如何写,为了赶deadline就草草的动手了。结果最终导致这一个星期的代码是基本上白写了,真是一个白痴。以前的经验教训都忘了,遇到事情还是不能冷静下来好好想想问题,还是容易受外界干扰。这下傻眼了,extended后的deadline看来还是赶不上了。

Anyway,现在无论如何也要停下来好好规划一下,不能再白痴了。。。

How to be a (sane) grad student (ZZ)

 
今天作New Grad SIG作业,看到美女老师Jelena的主页上介绍了一些做research的经验,转载一下…
 
When I was just starting my graduate studies I had no idea how a grad school works: when to work and how much, how to write papers, how to choose the Ph.D. topic, how to find an advisor, etc. It took me four years to finally find answers to all of my questions, mostly through trial and error. So here is the compiled version of those answers. Hopefully you are not like me, and can learn from other people’s mistakes, so these guidelines will actually be useful. Of course, they are neither comprehensive nor universal. Simply some wisdom that worked for me and may work for you, too.
 
How to manage your time as a grad student
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