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:
- glViewport is set to size of window (ie QGLWidget)
- 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.
- zoom with a rubber band to only a small portion of the photo - determine new scale by ratio of zoombox to glortho
- set glScale to new scale factor, expand glOrtho to scaled up size
- now mouse pick uses glunproject to get world coordinate
Is this the best way ?