Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Add glGetBoundingBox() function

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2001

    Add glGetBoundingBox() function

    Hi All,

    I suggest to add function which returns axis aligned bounding box of a drawing, i.e. calculates extremes of data to be drawn. This function would be very useful to set correct projection parameters.

    The straightforward way to calc vertex extremes separate from OpenGL is not elegant and easy. Some primitives are drawn with some glTranslate and glRotate is applied to them so that to calc the bounding box I have to do the same transformation calculations which OpenGL already has done. Why to do the same work twice??

    For example, in Win32 API there is the function GetRgnBox() which returns bounding box of defined region.


  2. #2
    Senior Member OpenGL Guru
    Join Date
    Mar 2001

    Re: Add glGetBoundingBox() function

    OpenGL is a low-level API. Information in OpenGL best travels in one direction: from your application to the implementation. Also, OpenGL does not, and should not, have any knowledge of "data to be drawn." It is only aware of the data you are currently telling it to draw right now.

    In order for an implementation to retrieve your bounding box, it would have to actually store a set of camera-space post-T&L'd data somewhere. What if you're using EXT_vertex_shader or NV_vertex_program and you don't have a notion of camera-space transforms for your data (or, at least, your modelview matrix is folded into your projection matrix)?

    Instead of transforming the actual object, why not transform the model-space bounding boxes into world space? They won't be axis-aligned anymore, but you can convert those un-aligned boxes into slightly larger aligned one easily enough.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts