上 传 者
说明： Panning zooming and rotation in OpenGL
base (0, 1999-06-01)
base\Arrow.cpp (922, 1999-05-28)
base\Arrow.h (111, 1999-05-28)
base\Camera.cpp (1466, 1999-05-28)
base\Camera.h (685, 1999-05-28)
base\CliMax.cpp (247, 1999-05-27)
base\CliMax.h (209, 1999-05-28)
base\CommonFunc.cpp (1643, 1999-05-28)
base\CommonFunc.h (237, 1999-05-10)
base\CoordinateAxis.cpp (494, 1999-05-27)
base\CoordinateAxis.h (192, 1999-05-28)
base\Ellipse.cpp (3138, 1999-05-28)
base\Ellipse.h (306, 1999-05-28)
base\FuncGrid3D.cpp (1268, 1999-05-28)
base\FuncGrid3D.h (96, 1999-05-28)
base\Geometry.cpp (1500, 1999-05-27)
base\Geometry.h (325, 1999-05-28)
base\JGLBase.h (62, 1999-05-17)
base\Material.cpp (641, 1999-05-01)
base\Material.h (430, 1999-05-28)
base\PolarizeLight.cpp (1779, 1999-05-28)
base\PolarizeLight.h (771, 1999-05-28)
base\Vector.cpp (1349, 1999-05-28)
base\Vector.h (816, 1999-05-28)
exe (0, 1999-06-01)
exe\light.exe (241664, 1999-05-28)
FileList.txt (355, 1999-05-29)
new (0, 1999-06-01)
new\panzoomrot.shtml (4731, 1999-06-01)
project (0, 1999-06-01)
project\GLSample2.clw (3088, 1999-05-28)
project\GLSample2.cpp (4016, 1996-06-14)
project\GLSample2.dsp (5270, 1999-05-27)
project\GLSample2.dsw (541, 1999-04-30)
project\GLSample2.h (1243, 1996-06-14)
project\GLSample2.mak (9772, 1996-06-07)
project\GLSample2.rc (10035, 1999-05-28)
project\GLSample2Doc.cpp (2091, 1996-06-14)
project\GLSample2Doc.h (1273, 1996-06-14)
project\GLSample2View.cpp (14671, 1999-05-28)
Pan,Zoom and Rotate the scene.
In this program ,I show some simple OpenGL code.There is nothing special ,but I thing it will be useful for someone.
1.Zoom out,zoom in and pan the scene.
2.Draw the standard primiry like cylinder in ambiguous direction.
3.Draw the 3-D Mesh in a simple way.
In my program ,I use the class to wrap the detail of the realization in OpenGL.So I can use it freely at any other program without consider what will be do first ,and what be second.
I have constructed a framework in Visual C++ 6.0,in which you can freely pan and rotate the scene ,without consider what is displaying in the scene.
How did I do that ?
/****Apply the Camera ********/
I construct CCamera and CScene class ,which take care of the rotate and pan of the camera and scene.In some program ,people use the glPushMatrix() and
glPopMatrix() to accomplish the simple transfer.I do this in another way.By using the TransferMatrix class ,which I define to contain the MODELVIEW matrix of a special object(like the CCamera),thing will be simple.
We know that ,the OpenGL using the transform of MODELVIEW matrix to accomplish complex drawing ,and the glTranslate(),glRotate() is all base on the current MODELVIEW matrix.So,if you want to transfer according to an ambiguous direction,it will be difficult.You have to mirror it into the current.Two suggestion to solve the problem.The first is to use the matrix stack by using glPushMatix(),glPopMatrix(),but it is easy to be wrong when there are a lot of transform action.The second is to apply a matrix to the object, one matrix per object.Using the glLoadMatrix(),glMultMatrix() to apply the Object's matrix into the OpenGL.
So the course is like this:
Init Camera ; //apply the Matrix of camera.
Init Scene; //apply the Matrix of scene.