zooming, picking examples

Yesterday’s thread on 2D zooming points out that a basic part of many projects is zooming, rubber-banding, picking and scrolling but I cannot find any good code examples(both linux and windows) of a project that includes all these and the openGL books are useless for such a real-life project. Are there any good examples of this out there ?

Here is a typical case:

  1. glViewport is set to size of window (ie QGLWidget)
  2. glortho set to the size of the image - if glviewpoint is smaller size, then scrollbars are needed, else if viewport set to a larger or same size, then no scrollbars.
  3. zoom with a rubber band to only a small portion of the photo - determine new scale by ratio of zoombox to glortho
  4. set glScale to new scale factor, expand glOrtho to scaled up size
  5. now mouse pick uses glunproject to get world coordinate
    Is this the best way ?

That seems reasonable. Though, there is seldom a “best way” for anything. Experimentation is key.

As for examples, try a google for existing open source editors out there. There are literally hundreds of them. For example, many of the quake editors are open source. Most any 3D editor out there will have this kind of functionality built into it.

True, but like finding needle in a haystack.

>>As for examples, try a google for existing open >>source editors out there. There are literally >>hundreds of them. For example, many of the quake >>editors are open source. Most any 3D editor out >>there will have this kind of functionality built >>into it.