When I need a arrow pointer ,I think of the cylinder and cone. M_Scene.Apply() // set scene transfer matrix M_Camera.Apply() // set the camera transfer matrix Init Objcet //apply the Matrix of object.ĭrawing Object //drawing the object įor( j=0 j < SubObjectNumber i++) //if there is any subobject. Init Camera //apply the Matrix of camera. Using the glLoadMatrix, glMultMatrix to apply the Object’s matrix into the OpenGL. The second is to apply a matrix to the object, one matrix per object. 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. So if you want to transfer according to an ambiguous direction, it will be difficult. 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. By using the TransferMatrix class ,which I define to contain the MODELVIEW matrix of a special object(like the CCamera),thing will be simple. 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. 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. 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. Draw the standard primiry like cylinder in ambiguous direction. Pan,Zoom and Rotate the scene In this program ,I show some simple OpenGL code.There is nothing special ,but I thing it can be useful for someone.Ģ.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |