delphi - How to adjust GLCamera to show entire GLScene -


I have a GLScene object of a different (but also known) size. It is completely a TGLDummyCube Is surrounded by.

I want to create the position of GLCamera (with CameraStyle: glPerspective ) so that the object is visible on fully visible I was running it basically - the object is visible, but the distance is sometimes too far, or the object is bigger than the screen and is cut.

How can I do this? I think this camera can be done by a clever combination of distance and focal length, but I have not been successful yet.

It looks different in GLCCEN compared to OpenGL. I am using GLCCEN and Delphi 2007.

Although camera distance and focal length varies, object view size, there is a lack of change in its perspective , Thus leading one to a somewhat distorted view. I suggest using the camera's SceneScale property instead.

Hey, I do not have any valid steps to calculate the right value for it. In my case I have to scale with a different size in a cube, while the viewer's window size is constant is. So I put two dummy cubes in place of the target cube, the size of each was either size of the viewer or fit for SceneScale , camera distance and FocalLength Are there. During the runtime, I calculate the new SceneScale with the ratio of the target cubes size in relation to the dummy shape size. It works very well in my case.

Edit : Here are some code for calculation.

  • ZoomerFox and Zoom RFE those dummy bobs
  • target dimensions and target The size of the current object
  • DesignWidth and DesignHeight size MyGLView design time
  • < Li> DesignSceneScale is the camera's view level design time

calculation code:

  ScaleX: = (Zoomerfix.combs * MyGLView.Width) / (DesignWidth * TargetDimX); Scale: = (ZoomReiffi.com) * MyGLView.Height / (Design Hight * Target); NewcastleCell: = Min (Scalex, Scaley Y) * DesignsCensenCell;  

DummyCubes zoomerfucks and zoomFridge are given so that they have a small margin on the left-right or top-bottom edges Ho. Both of the viewing window are deployed to face the match in front. Apart from this, target objects are also deployed to match their face with these dummy cubes.

The formula above allows the size of the window to be separated from the design time, but in fact I have not tested this feature.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -