开发者

OpenGL: getting clipping planes that will bound the entire scene

开发者 https://www.devze.com 2023-01-21 14:39 出处:网络
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.

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消