I am looking for a way to display my entire scene on the screen. This involves a call to glOrtho() with my clipping plane bounds.
However, the size of my scene is dynamic and as such, I need to find a way to determine a projection box that will co开发者_运维百科ntain the whole scene.
Any suggestions?
You will need to know the bounding boxes of every object in your scene. Then you can keep expanding your scene's bounding box by each object that is in it. You can see an example of this in OpenSceneGraph using their BoundingBox class.
If you need to get the bounding box for a particular object, you can just store the minimum and maximum values along each axis as you load the model (since bounding boxes are axis aligned).
精彩评论