随笔 - 85  文章 - 47  trackbacks - 0

常用链接

随笔分类

随笔档案

搜索

  •  

最新评论

1. 在 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0000、0001、0002等主键下,查找DriverDesc,内容为你要修改的网卡的描述,如“Realtek RTL8029(AS)-based PCI Ethernet Adapter”。
2. 如果在0001下找到了1中的DriverDesc,在其下,添加一个字符串,命名为NetworkAddress,其值设为你要的MAC地址(注意地址还是连续写)。如:00E0DDE0E0E0。
3. 然后到其下Ndi\params中添加一项名为NetworkAddress的主键,在该主键下添加名为default的字符串,其值是你要设的MAC地址,要连续写,如:000000000000。(实际上这只是设置在后面提到的高级属性中的“初始值”,实际使用的MAC地址还是取决于在第2点中提到的NetworkAddress参数,这个参数一旦设置后,以后高级属性中的值就是NetworkAddress给出的值而非default给出的了。)
4. 在NetworkAddress的主键下继续添加名为ParamDesc的字符串,其作用为指定NetworkAddress主键的描述,其值可自己命名,如“Network Address”,这样在网卡的高级属性中就会出现Network Address选项,就是你刚在注册表中加的新项NetworkAddress,以后只要在此修改MAC地址就可以了。继续添加名为Optional的字符串,其值设为“1”,则以后当你在网卡的高级属性中选择Network Address项时,右边会出现“不存在”选项。
5. 重新启动你的计算机,打开网络邻居的属性,双击相应网卡项会发现有一个Network Address的高级设置项,可以用来直接修改MAC地址或恢复原来的地址(选中不存在)。

For Windows 2000/XP

Method 1:
This is depending on the type of Network Interface Card (NIC) you have. If you have a card that doesn’t support Clone MAC address, then you have to go to second method.
a) Go to Start->Settings->Control Panel and double click on Network and Dial-up Connections.
b) Right click on the NIC you want to change the MAC address and click on properties.
c) Under "General" tab, click on the "Configure" button
d) Click on "Advanced" tab
e) Under "Property section", you should see an item called "Network Address" or "Locally Administered Address", click on it.
f) On the right side, under "Value", type in the New MAC address you want to assign to your NIC. Usually this value is entered without the "-" between the MAC address numbers.
g) Goto command prompt and type in "ipconfig /all" or "net config rdr" to verify the changes. If the changes are not materialized, then use the second method.
h) If successful, reboot your system.

Method 2:
This should work on all Windows 2000/XP systems
a) Go to Start -> Run, type "regedt32" to start registry editor. Do not use "Regedit".
b) Go to "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}". Double click on it to expand the tree. The subkeys are 4-digit numbers, which represent particular network adapters. You should see it starts with 0000, then 0001, 0002, 0003 and so on.
c) Find the interface you want by searching for the proper "DriverDesc" key.
d) Edit, or add, the string key "NetworkAddress" (has the data type "REG_SZ") to contain the new MAC address.
e) Disable then re-enable the network interface that you changed (or reboot the system).

Method 3:
Use the program Etherchange from http://ntsecurity.nu/toolbox/etherchange/
posted @ 2008-08-31 00:16 w2001 阅读(766) | 评论 (0)编辑 收藏
http://www.raytheon.com/newsroom/technology/rtn08_exoskeleton/

posted @ 2008-06-06 16:35 w2001 阅读(149) | 评论 (0)编辑 收藏
1. 安装firefox 2/3,先不要运行
2. 在其各自的快捷方式中添加命令参数"-profilemanager -no-remote"
3. 运行之,在配置文件管理器中分别为ff 2/3创建独立的配置文件,比方说ff2、ff3
4. 然后,在各自的快捷方式中将命令行参数改为"-p ff2 -no-remote"和"-p ff3 -no-remote"
5. 至此,共存配置完毕,二者可以独立或同时运行且互不影响....

http://www.blueidea.com/computer/soft/2008/5368.asp
http://www.firefox.net.cn/newforum/viewtopic.php?p=170719
posted @ 2008-05-27 02:15 w2001 阅读(219) | 评论 (0)编辑 收藏
1. 安装TortoiseSVN客户端

2. 安装服务器端svn-x.x.x-setup.exe

3. 手工创建svn储存库(repository),也可以用TortoiseSVN来做
svnadmin create F:\svn\

4. 配置svn储存库,使用密码,设置用户名/密码
编辑/conf/svnserve.conf,
# [general]
password-db = passwd
编辑/conf/passwd,
# [users]
my_id = my_password

5. 手工后台运行svn服务器,用TortoiseSVN测试一下成功否
svnserve -d -r F:\svn

6. 如果需要将svn配置成windows服务,安装svnservice最简单

7. 接下来,用TortoiseSVN签入签出吧

8. Apache就免了,不跨平台开发的话,没太多用

http://tortoisesvn.tigris.org/
http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91
http://svnservice.tigris.org/
posted @ 2008-05-18 18:46 w2001 阅读(369) | 评论 (0)编辑 收藏
1. 启用内存泄漏检测

#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>

当退出程序位置固定时,用:
_CrtDumpMemoryLeaks();

定义了_CRTDBG_MAP_ALLOC 时,会显示内存块类型和内存块分配编号(在大括号内)。

当退出位置不固定时,用:
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );

该语句在程序退出时自动调用 _CrtDumpMemoryLeaks。必须同时设置 _CRTDBG_ALLOC_MEM_DF 和 _CRTDBG_ALLOC_MEM_DF 两个位域。

2. 内存块类型

“普通块”是由程序分配的普通内存。
“客户端块”是由 MFC 程序用于需要析构函数的对象的特殊类型内存块。MFC new 操作根据创建对象的需要创建普通块或客户端块。
“CRT 块”是由 CRT 库为自己使用而分配的内存块。CRT 库处理这些块的释放,因此您不大可能在内存泄漏报告中看到这些块,除非出现严重错误(例如 CRT 库损坏)。

3. 内存泄露定位 - 在内存分配编号上设置断点

先通过_CrtDumpMemoryLeaks查到泄露的内存块分配号n,然后添加语句

_CrtSetBreakAlloc(n);

Debug程序运行后,将自动断点至分配处

4. 内存状态比较

_CrtMemCheckpoint( &s1 );
// memory allocations take place here
_CrtMemCheckpoint( &s2 );

if ( _CrtMemDifference( &s3, &s1, &s2) )
   _CrtMemDumpStatistics( &s3 );

5. CRT内存泄露误报

在某些情况下,_CrtDumpMemoryLeaks 可能给出错误的内存泄漏指示。如果使用将内部分配标记为 _NORMAL_BLOCK 而不是 _CRT_BLOCK 或 _CLIENT_BLOCK 的库,则可能发生这种情况。其结果是,_CrtDumpMemoryLeaks 无法区分用户分配和内部库分配。如果库分配的全局析构函数在您调用 _CrtDumpMemoryLeaks 的位置之后运行,则每个内部库分配都被作为内存泄漏进行报告。Visual Studio .NET 之前的早期版本的标准模板库会导致 _CrtDumpMemoryLeaks 报告这样的错误指示,但在最新版本中此问题已经得到解决。
posted @ 2008-05-10 04:40 w2001 阅读(685) | 评论 (0)编辑 收藏
OpenGL VBO并不难,但是较繁琐,其实其概念跟加载纹理是一样的:

初始化阶段:
1. glGenBuffersARB(1, &nVBOVertices); //生成一个句柄
2. glBindBufferARB(GL_ARRAY_BUFFER_ARB, nVBOVertices); //声明该句柄为一个vbo句柄,并选择之
3. glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(vertices), vertices,GL_STATIC_DRAW); //将顶点集上传至server端

使用阶段:
1. glEnableClientState(GL_VERTEX_ARRAY); //开始使用vbo
2. glBindBufferARB(GL_ARRAY_BUFFER_ARB, nVBOVertices);  //选择当前使用的vbo
3. glVertexPointer(3, GL_FLOAT, 0, BUFFER_OFFSET(0));  //指定vbo顶点格式
4. glDrawArrays( GL_TRIANGLES, 0, g_pMesh->m_nVertexCount ); //画吧
5. glDisableClientState(GL_VERTEX_ARRAY); //停止使用vbo

收尾阶段:
1. glDeleteBuffersARB(1,&nVBOVertices); //删除句柄,同时删除server端顶点缓冲

再来看看纹理缓冲是怎么使用的,其实差不多:

初始化阶段:
1. glGenTextures(1, &texID);//创建句柄
2. glBindTexture(GL_TEXTURE_2D, texID); //设置句柄类型
3. glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img->GetWidth(), img->GetHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, raw_rgba); //上传纹理缓冲

使用阶段:
1. glEnable(GL_TEXTURE_2D); //开始使用纹理缓冲
2. glBindTexture(GL_TEXTURE_2D, texID); //选择当前使用的纹理缓冲
3. 发送顶点和纹理坐标,画吧...省略
4. glDisable(GL_TEXTURE_2D); //停止使用纹理

收尾阶段:
1. glDeleteTextures(1,&texID);//删除句柄,,同时删除server端缓冲

看到了么,这个概念是不是很相似?都是:

1. 创建句柄
2. 设置句柄类型
3. 上传数据
4. 开始使用缓冲
5. 选择句柄
6. 使用缓冲
7. 停止使用缓冲
8. 删除句柄和缓冲
posted @ 2008-05-10 00:31 w2001 阅读(8211) | 评论 (4)编辑 收藏

Jack Ritter, "An Efficient Bounding Sphere" in Graphic Gems (1990)

1. 在三维点集S中找到较远的两点,构成一个初始包围球估计B0。该球可以如是求:遍历S,求出其中x坐标最大/最小、y最大/最小及z最大/最小的3对点,然后取其中距离最大的一对,以其二点连线中点为球心C0,距离的一半为初始半径R0
2. 然后再次遍历S,逐一测试S中其他点是否处于B中;
3. 如果点Pk处于Bk中,则继续测试下一个点Pk+1
4. 如果Pk不处于Bk中,则:作Bk的球心Ck与Pk的连线矢量(Ck,Pk),并反向延长至与Bk相交,交点为Qk,以连线(Qk,Pk)的中点为新的球心Ck+1,其距离的一半为新的球半径Rk+1,构成新的包围球Bk+1,不难发现,Bk与Bk+1相切于Qk
5. 上述过程迭代至所有S中的P点遍历完为止。以上近似算法可扩展到n维空间。
6. 该算法特点:快速,且包围球几乎最小,虽不能保证绝对最小,但绝对优于基于包围盒算出来的解



According to Jack Ritter a near-optimal sphere can be created by:
1) Finding the minimal and maximal vertices along each axis (x,y,z).
2) For those three pairs chose the one pair which has the largest distance.
3) The center of the sphere is the midpoint between those two vertices and its radius is half the distance between them.
4) Go through all vertices again, if you find a vertex whose distance (d) is greater than the radius (r), move the sphere towards this vertex by (d-r)/2 and then set the new sphere radius to (d+r)/2.

posted @ 2008-05-05 02:32 w2001 阅读(981) | 评论 (0)编辑 收藏
glut/glew简单配置

1. 所有lib,丢C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib
2. 所有.h,丢C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Include\gl
3. 所有.dll和bin,丢C:\WINDOWS\system32
4. 把项目的Unicode去掉,包括Debug和Release(for glut)
5. 项目预编译头文件里面,添:
#include <GL/glew.h>
#include 
<GL/glut.h>
#pragma comment(lib,
"opengl32.lib")
#pragma comment(lib,
"glew32.lib")
#pragma comment(lib,
"glut.lib")
#pragma comment(lib,
"glut32.lib")
6. 开始玩....进一步参考简单glut及glew程序模板

CxImage在OpenGl中的应用

注意,不能将CxImage::GetBits()直接用于OpenGL,否则会:
1. 纹理上下颠倒
2. 纹理中像素点格式为BGR
3. 不能用于GL_RGBA,只能GL_RGB,GetBits获取不到Alpha分量

如果一定要用CxImage::GetBits(),必须进行如下操作:
1. CxImage::SwapRGB2BGR()
2. CxImage::Flip()

推荐在OpenGl全用CxImage::Encode2RGBA获取Bitmap,用了之后啥麻烦事都没了.....
posted @ 2008-05-01 16:24 w2001 阅读(1875) | 评论 (1)编辑 收藏
First, think what you want these matrices do.
Let we have transformation matrices A and B . We want to transform vector V by both and get vector V'.
But above is not enough to specify what we want to do, as
first transform by A then transform by B
and
first transform by B then transform by A
are different. You can just try to play with rotations in real world.(get a cube, paint x,y,z on sides, etc.)

Now, more on how it's done:

first transform by A then transform by B
It is easy to see that this is accomplished by:
In openGL's convention:
V'=B*(A*V)
Note that it is same as
V'=(B*A)*V
so you can do it as
C=B*A;
V'=C*V;
In DX's convention:
V'=(V*A)*B
C=A*B;
V'=V*C;
(note: real operations done on memory is the same. It's just matter how we map matrix indices to memory)
As you see, V*A*B and B*A*V is kind of symmetrical. Same for consequently applied transforms like V*A*B*C*D*E*F or F*E*D*C*B*A*V

Now, write it down for "transform by B then transform by A" yourself to remember it better.

When you render something , you want points to be transformed by
matrix of object
matrix of parent object
matrix of grandparent object ...
matrix of camera
(and done by API, projection matrix)
From there you can find what order of multiplications you want. In OGL, you need to
m=matrix_of_camera*matrix_of_grandparent_objectmatrix_of_parent object*matrix_of_object;
...
then if you'll glLoadMatrix, OpenGL will do
vertice=m*vertice;

Some more notes: Let you have spacecraft with spacecraft-to-world matrix M
And you use OpenGL convention.
For example, to turn spacecraft around spacecraft's local X direction, you need to
M=M*axis_angle_to_matrix(Vector(1,0,0),angle);
(note: you need to reorthonormalize matrix if you do that incrementally)
To turn spacecraft around global X direction, you need to
M=axis_angle_to_matrix(Vector(1,0,0),angle)*M;


On openGL:

This sequence

glMatrixMode(GL_MODELVIEW);
glMultMatrix(A);
glMultMatrix(B);
glMultMatrix(C);
... render your mesh ...
works as if your mesh would be transformed by C,then B, then A
It makes lot of sense, if you for example want to render a robot with matrices giving positions of child nodes (fingers) relativelty to parent (arm), and arm are responsible for positioning fingers, you can do
RenderArm(){
glPushMatrix();
glMultMatrix(matrix_of_first_finger);
RenderFinger();
glPopMatrix();
glPushMatrix();
glMultMatrix(matrix_of_second_finger);
RenderFinger();
glPopMatrix();
}
and so-on(simplified example)
Then, you can have
glPushMatrix();
glMultMatrix(matrix_of_arm);
RenderArm();
glPopMatrix();

and it will work properly.

If you have more questions, ask.
posted @ 2008-04-30 22:05 w2001 阅读(1344) | 评论 (2)编辑 收藏
等待
完美生活


posted @ 2008-02-06 22:49 w2001 阅读(130) | 评论 (0)编辑 收藏
仅列出标题
共9页: 1 2 3 4 5 6 7 8 9