[ Previous | Next | Contents | Glossary | Home | Search ]
The graPHIGS Programming Interface: Understanding Concepts

Chapter 15. Advanced Viewing Capabilities

The viewing functions provided by graPHIGS API enable you to define or modify views on the World Coordinate System (WCS). Your application must define a view. This involves specifying:

These viewing parameters are stored in a view table entry and maintained by the designated workstation. There is one entry per view in this table. If you need to define multiple views, priorities of these views with respect to each other can also be controlled by viewing functions.

The first part of this book (Basic), offered examples and illustrations for many viewing functions. This chapter gives you additional viewing functions that will enable you to increase the application's capabilities and improve performance.

View Priority

Views in the graPHIGS API are related by their input and output priority. View input priority is used to determine which view specification is used to transform LOCATOR and STROKE input from Device Coordinates (DC) to World Coordinates (WC). The decision is made based on the view with the highest relative input priority of all the overlapping views which contain the LOCATOR point or STROKE points. View output priority determines which views are drawn on an output device first. In this case, views with lower priority are drawn first so that higher priority views are drawn on top when overlapping views.

The Set View Priority (GPVP) subroutine sets view output and input priorities. This may create problems for some applications. For example, you may wish to display an icon in one corner of a viewport to represent the view orientation within the viewport. The orientation of the icon should change as the view transformation changes, but it should not scale or translate. The icon will always be visible regardless of the content of the view. The easiest way to accomplish this is by using two viewports. The first viewport corresponds to the actual application view. The second overlays the first with higher output priority, and has shielding turned off. Your application would then change the transformation matrix of the second view whenever the first changes, after removing translations and scaling.

Although using two viewports satisfies the output requirements, it may create a problem for input. If you trigger the LOCATOR near the icon (within the icon viewport), the LOCATOR position will be returned with the inverse transform of the icon view, not the actual view of interest. Ultimately, the best solution is to use two unique subroutines for control of input priority and output priority. The first subroutine, Set View Output Priority (GPVOP), controls the relative output priority generated for each view on the display surface. The second, Set View Input Priority (GPVIP) subroutine, controls the relative input priority of the viewports for determining which view to use in transforming LOCATOR and STROKE input.

Two inquiry subroutines, Inquire Current View Table Entries (GPQCVE) and Inquire Requested View Table Entries (GPQRVE), return the view indexes in the order of decreasing input priority. The Inquire Current View Table Entries Output (GPQCVO) and Inquire Requested View Table Entries Output (GPQRVO) subroutines return the view indexes in the order of decreasing output priority. The current view table entries will equal the requested entries after a workstation is updated.

View Table Entry

The Set Extended View Representation (GPXVR) subroutine enables you to set a view table entry that includes the following items:

Following is a discussion of each of the items listed above:

Window Clipping Indicator

The window clipping indicator for a view can be either ON or OFF and specifies whether or not primitives are clipped to the window boundary of a view.

Near and Far Plane Clipping Indicator

In addition to the clipping which can occur at the window boundary, clipping can also be performed at the near and far clipping plane of a view under the control of the Near and Far Clipping Plane Indicator. Near and far clipping planes are discussed in detail in Chapter 5. "Viewing Capabilities"

View Shielding Indicator and Color

The background or "shield" of a view can be turned ON or OFF with the View Shielding Indicator. When turned ON , a view's background is filled with the View Shielding Color which can be specified as an index into the workstation's rendering color table or as a direct color vector. A view's background shield provides a means for your application to block the contents of overlapping lower priority views. The use of view shielding can also improve the performance of your application when views overlap due to the use of view optimization by the graPHIGS API

View Border Indicator and Color

The border of a view can be turned ON or OFF using the View Border Indicator. When ON , the border is drawn in the color specified by the View Border Color.

Temporary View Indicator

In some applications, pop-up areas, such as pop-up menus, are used to interact with the user. These areas are typically active for a relatively short period of time and usually have the highest or near highest display priority. Also, these areas usually have the user's attention so there will be few changes to other regions of the display.

The content of these pop-up areas is usually simple, yet they may be comprised of any combination of primitives and attributes. Through the graPHIGS API, pop-up areas are best simulated through the use of views where each pop-up area corresponds to a graPHIGS API view with shielding turned on. The initial display performance of these areas is typically quite good due to the redraw optimization techniques provided by the graPHIGS API However, the deactivation or removal of a pop-up area may take a long time depending on the complexity of the underlying views.

To improve the performance of deactiviating a pop-up area, a view can be marked as "temporary" through the Temporary View Indicator. Views marked as temporary can then be processed in a workstation-dependent way to optimize the deactivation of the view.

Hidden Line/Hidden Surface Removal

The use of Hidden Line/Hidden Surface Removal (HLHSR) in each view can be controlled by your application through the Hidden Line/Hidden Surface Removal mode. To determine which HLHSR modes are supported on a particular workstation, use the Inquire Available HLHSR Modes (GPQHMO) subroutine. A complete discussion of HLHSR is contained in Chapter 16. "Rendering Pipeline"

Transparency Processing

Like HLHSR, the transparency processing of a view may be controlled by your application. To determine which transparency modes are supported on a particular workstation, use the Inquire Available Transparency Modes (GPQTMO) subroutine. A complete discussion of transparency processing is contained in "Transparency" See also "Shield Alpha Value"

Color Processing

You can control the Initial Color Processing Model of a view through the Initial Color Processing Index, which is an index into the workstation's color processing model table. This control determines the mode used for the display of images mapped to the view, as well as the traversal default for structures associated to the view. The support for color processing on a particular workstation can be inquired using the Inquire Color Processing Facilities (GPQCPF) subroutine. For more information on color processing, see Chapter 17. "Manipulating Color and Frame Buffers"

Note: The Initial Color Processing Model does not affect the view's shielding or border colors. These colors are always quantized using color processing table entry zero.

Frame Buffer Protect Mask

A frame buffer mask may be used to protect individual frame buffer bit planes within the specified view. For more information on frame buffers and frame buffer masks, see Chapter 17. "Manipulating Color and Frame Buffers"

Viewport Settings

Your application can set the 2D or 3D viewport of a view which controls where the view will be displayed in Normalized Projection Coordinates (NPC). For more information concerning viewport setting, see Chapter 5. "Viewing Capabilities"

View Volume Settings

A viewing volume specifies the region of World Coordinate (WC) space which will be visible through a graPHIGS API view. The volume indicates the following information:

For more information concerning viewing volumes, see Chapter 5. "Viewing Capabilities"

View Matrix

Your application can use a 2D or 3D view matrix to transform an object's coordinates from the World Coordinate System (WCS) to the Viewing Coordinate System (VCS). A 2D matrix is specified as a 3 [default] 3 homogeneous matrix, and the graPHIGS API expands it to a 4 [default] 4 matrix.

View Activity

A view can be defined as active or inactive for both input or output. When active for input, a view can be used to transform locator and stroke data from Device Coordinates (DC) to World Coordinates (WC). The contents of a view which is active for output will be drawn on the display surface when the workstation is updated.

The view icon problem discussed at the beginning of this chapter in the view priority section can also be solved using view activity. In this case, the view containing the view orientation icon would be activated for output only, and the other view would be activated for both input and output. By activating the icon view for output only, the view will not be considered for transforming locator or stroke input.

View Mapping Matrix

To transform an object's coordinates from Viewing Coordinates to Normalized Projection Coordinates (NPC), a view mapping matrix is used. This transformation can also be specified using the view volume settings, as discussed previously. The view mapping matrix is simply an alternative method.

In the viewing process, transforming from WCS to VCS is processed by a view matrix. The view mapping matrix is then used to transform the coordinates from VCS to NPC coordinates. Your application can create a view mapping matrix using the Evaluate View Mapping Matrix subroutines (GPEVM3 and GPEVM2)

Antialiasing Mode

The view's Antialiasing Mode controls the effect of a structure's antialiasing identifier attribute. If the view's mode is OFF , then no antialiasing is performed, otherwise, antialiasing is performed as specified by the antialiasing attribute. Two modes of antialiasing are available. Antialiasing Mode 2=SUBPIXEL_ON_THE_FLY results in the highest quality rendering. 3=NON_SUBPIXEL_ON_THE_FLY provides better performance. Antialiasing techniques are workstation dependent and may not be available on all workstations. Refer to the workstation description information in The graPHIGS Programming Interface: Subroutine Reference for a description of available antialiasing methods and restrictions. Use the Inquire Available Antialiasing Modes (GPQAMO) to determine the antialiasing capabilities available on your workstation.

Shield Alpha Value

The shield alpha value is used in the transparency blending operation and is expressed as an integer in the range of 0 to 255. You use this value to initialize the destination alpha values (alphadest ) when alpha planes are present and the shielding indicator is on. The initial shield alpha value does not effect the initial shield color, but is used to blend subsequent primitives with the view shield when blending is in effect. If no value is specified, then the value of 255 is used for the initial alpha value. See "Transparency" for a discussion of the blending function.

[ Previous | Next | Contents | Glossary | Home | Search ]