SGI Techpubs Library

IRIX 6.5  »  Books  »  Developer  »  
OpenGL Optimizer Programmer's Guide: An Open API for Large-Model Visualization
(document number: 007-2852-002 / published: 1998-06-09)    table of contents  |  additional info  |  download
find in page

Appendix B. OpenGL Optimizer Sample Applications

To help you get started, the OpenGL Optimizer library includes applications that illustrate OpenGL Optimizer applications in individual subdirectories of the /usr/share/Optimizer/src/apps directory. Some of the sample applications are compiled for you in /usr/sbin and /usr32/sbin. You can modify, compile, and run sample applications if you install both the eoe and dev portions of the OpenGL Optimizer image.

This appendix discusses the most important sample applications in the following sections:


Note: For installation instructions, see Appendix A, “Installing OpenGL Optimizer.”


Command-Line Options and User Input

The sample applications all run similarly. To see the available command-line options, invoke the executable without any arguments:

% opviewer

The sample applications have many command-line arguments; for example, opviewer and opoptimize both have over 20. Optional arguments for demonstration applications should be placed after any required arguments when you invoke a sample application. For example, opviewer and opoptimize require only filename arguments, so command lines could look like the following:

% opviewer xxx.csb -useDL 
% opoptimize xxx.csb -batch test.csb

To print a list of interactive program controls into your command shell while you run a sample application place the mouse cursor in the rendering window and enter h, for help. Note that opxmviewer has a menu-based input instead.

opviewer Sample Application

opviewer illustrates the basic structure of a complete OpenGL Optimizer application that includes most of the OpenGL Optimizer rendering tools. It uses the graphical user interface tools in /usr/share/Optimizer/src/libopGUI. The important tools in this library, opViewer and opDefDrawImpl are discussed in Chapter 2, “Basic I/O: Getting Started with OpenGL Optimizer.”

opviewer provides run-time options for viewing a model displaying at an optimized frame rate.

A line-by-line commentary on opviewer appears in Appendix C, “opviewer Sample Application.”

The command-line options for opviewer are defined in the file /usr/share/Optimizer/src/apps/opviewer/main.cxx. Interactive control options are defined by the class opDefDrawImpl, which is in the /usr/share/Optimizer/src/libopGUI directory and is discussed in Chapter 2 in “opDrawImpl Subclasses Used In Sample Applications”.

Motif Version of opviewer

opxmviewer is the Motif version of opviewer. opxmviewer allows user input through a menu bar instead of command-line input. /usr/share/Optimizer/src/libopXmGUI is the motif version of /usr/share/Optimizer/src/libopGUI.

opxmviewer is a typical Motif application that creates a main window and a menu bar. The application also creates an opXmViewer widget attached to the main window. opXmViewer is the motif version of opViewer, discussed in “Viewing Class: opViewer”. opXmViewer is a composite Motif widget consisting of a main drawing area, an information area (for help text), and a user interface area.

opxmviewer takes the same command-line options as opviewer, with the exception of occlusion culling and no-picking options: occlusion culling is not available and the picking option is always on. Interactive controls are defined by the class opXmDrawImpl, which is the Motif analog to a combination of opDefDrawImpl and opPickDrawImpl, which are discussed in “Controlling Rendering: opKeyCallback and opDrawImpl”; and in “Interacting With a Rendered Object: opPickDrawImpl”.

As in opviewer, translation, rotation and zoom are done in opxmviewer using the mouse in the drawing area. Unlike opviewer, the other interactions are controlled by buttons in the user interface area, rather than by keyboard commands. If users pass the cursor over a button, the help text associated with that button is displayed in the information area.

X Version of opviewer

opxdemo is the X version of opviewer. opxdemo illustrates how to render a Cosmo3D scene graph inside an X Window. It presents a minimal OpenGL Optimizer application and emphasizes the rendering process. It includes the necessary routines from the following libraries: X Window, OpenGL extensions to X, Cosmo3D, and OpenGL Optimizer.

Other Sample Applications

This section discusses other sample applications included with the software and discussed in this manual.

Scene Graph Tuning—opoptimize

opoptimize uses most of the OpenGL Optimizer scene-graph-tuning tools that include simplifying shapes, creating LODs, and writing out .csb files. It is mainly used in batch processing mode, although it is possible to view the scene graph using an opViewer (see “Viewing Class: opViewer”).

A line-by-line commentary for opoptimize appears in Appendix D, “Scene Graph Tuning With the opoptimize Application.” This application adds to opviewer the command-line options and keyboard controls from the file /usr/share/Optimizer/src/apps/opoptimize/main.cxx.

Creating LODs—mergeLODDemo

mergeLODDemo creates level-of-detail (LOD) nodes at leaf nodes. mergeLODDemo provides fewer options than opoptimize, which places LOD nodes near the root of the scene graph.

This application illustrates how to combine topologically identical scene graphs that contain leaf nodes with differing levels of detail. See “Merging Graphs With Differing Levels of Detail: opMergeScenes”.

Rendering Higher Order Reps—repTest

repTest is used for rendering higher-order reps, providing an environment for developing and rendering these objects.

This application is discussed in Chapter 9, “Higher-Order Geometric Primitives and Discrete Meshes.” It adds to opviewer command-line options from in the file /usr/share/Optimizer/src/apps/reptest/main.cxx.

Using Topology—topoTest

topoTest illustrates the use of the OpenGL Optimizer topology building tools to “stitch” together surfaces. It is designed to help you import surfaces whose connectivity you know so that you can use the OpenGL Optimizer tessellators to get crack-free images. The application also illustrates an approach to developing trimmed NURBS surfaces that differs somewhat from that used in repTest.

Topology building tools are discussed in Chapter 10, “Creating and Maintaining Surface Topology.”

Scientific Visualization

opviz illustrates how to use OpenGL Optimizer to visualize discrete scientific and engineering data.

This application is discussed in the section “Sample Mesh Tessellation: opviz and opVizViewer”. It adds to opviewer the command-line options that appear in the file /usr/share/Optimizer/src/apps/opviz/main.cxx, and the interactive commands that appear in opVizViewer.cxx.

Reflection Mapping

zebraFly illustrates the use of reflection mapping to get tube-lighting effects, which simulate lighting by fluorescent lights in a cylindrical room. The file /usr/share/Optimizer/src/apps/zebrafly/README describes the basic controls for the application, which is based on opviewer.

Reflection mapping tools are discussed in Chapter 8, “Efficient High-Quality Lighting Effects: Reflection Mapping.”

OpenGL Optimizer Programmer's Guide: An Open API for Large-Model Visualization
(document number: 007-2852-002 / published: 1998-06-09)    table of contents  |  additional info  |  download

    Front Matter
    About This Guide
    Part I. Getting Started
    Part II. High-Level Strategic Tools for Fast Rendering
    Part III. Specific Tools for Fast Rendering
    Part IV. Managing and Rendering Higher-Order Geometric Primitives
    Part V. Traversers, Low-Level Geometry Processing, and Multiprocessing
    Part VI. Utilities and Troubleshooting
    Part VII. Appendices
    Glossary
    Index


home/search | what's new | help