HP PEX Implementation and Programming Supplement HP9000 Series 700 Color Workstations ABCDE HP Part No. B2355-90118 Printed in USA June 1996 E0696 FINAL TRIM SIZE : 7.5 in x 9.
Notices The information contained in this document is subject to change without notice. Hewlett-Packard provides the following material \as is" and makes no warranty of any kind with regard to this manual, including, but not limited to, the implied warranties of merchantability and tness for a particular purpose.
PEX and PEXlib are trademarks of the X Consortium. Copyright c 1996, Hewlett-Packard Company FINAL TRIM SIZE : 7.5 in x 9.
Printing History New editions of this manual will incorporate all material updated since the previous edition. The manual printing date and part number indicate its current edition. The printing date changes when a new edition is printed. (Minor corrections and updates which are incorporated at reprint do not cause the date to change.) The manual part number changes when extensive technical changes are incorporated. June 1996 . . . Edition 1. This manual is valid for HP PEX 5.
0 0 About This Book This manual is intended primarily for programmers of graphics applications and assumes familiarity with PEXlib and the installation and setup of graphics workstations. We also assume a knowledge of the C programming language and the X Window System . Important information for system administrators is also included to aid installation, system maintenance, and troubleshooting.
0 What's New in This Book Product changes re ecting added functionality in this new edition of the HP PEX Implementation and Programming Supplement for HP PEX 5.
0 HP CDE and HP VUE Hewlett-Packard is in the process of moving its users to a standard user environment. Two user environments will be shipped with HP-UX 10.20: HP VUE and HP CDE (Common Desktop Environment). Starting with HP-UX 10.20, HP CDE will be the default user environment. HP VUE will be available with HP-UX 10.20, but will not be available in future HP-UX releases. From a 3D graphics point of view, the change in user environments should be transparent.
0 HP PEX Learning Products Information about HP PEX and/or PEXlib is found in these books: PEXlib Programming Manual |This manual provides detailed instructions for learning and using PEX lib. Written by Tom Gaskins and published by O'Reilly and Associates, it provides beginners with the basics for getting started in PEXlib. Experienced programmers will use this book as a reference for more detailed information|beyond the basics. ISBN 1-56592-028-7.
0 Documentation Published by O'Reilly and Associates O'Reilly and Associates are no longer printing the following manuals: PEXlib Programming Manual PEXlib Programming Reference Although they are no longer orderable from O'Reilly and Associates, you may still nd these manuals in bookstores that carry technical documentation. Document Conventions verbatim OC PEX PEXlib This book makes extensive reference to PEXlib programming commands.
FINAL TRIM SIZE : 7.5 in x 9.
Contents 0. About This Book What's New in This Book . . . . . . . . . . . . . HP CDE and HP VUE . . . . . . . . . . . . . . HP PEX Learning Products . . . . . . . . . . . . Documentation Published by O'Reilly and Associates Document Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1. An Overview of the HP PEX Product The HP PEX Product . . . . . . . . . . . . . . . . . . . Supporting The Common Graphics Environment (CGE) . . . Supporting Selected PEX 5.
2. Installation And Setup Introduction . . . . . . . . . . . . . . . . . . . . . . . Special Considerations for the HP-UX 10.0 Release . . . . . Special Consideration for the HP-UX 9.0X Releases . . . . . HP-UX and Older HP PEX Applications Running on a More Recent HP-UX 9.07 System . . . . . . . . . . . . . . HP-UX New HP PEX Applications Running on Older HP-UX Systems . . . . . . . . . . . . . . . . . . . . . . HP-UX 9.05 or 9.07 X Windows Applications Running on HP-UX 9.01 or 9.03 . . . . . . . . . . . .
Using Environment Variables . . . . . . . . . . . . . . Environment Variable|To Specify Color . . . . . . . . Environment Variable|PEX Protocol Method . . . . . Environment Variables|Compliance Mode . . . . . . . Using HPPEX DHA AUTO COLOR APPROX . . . . Environment Variable|Colormaps . . . . . . . . . . Using SB_X_SHARED_CMAP . . . . . . . . . . . . . . The CRX Device And Color Support . . . . . . . . . Environment Variable|Color Recovery . . . . . . . .
Performance Analysis Tools . . . . . . . . . . . . . Pro ling Your Code . . . . . . . . . . . . . . . . Pro led PEXlib . . . . . . . . . . . . . . . . . Other Tools . . . . . . . . . . . . . . . . . . . Interpreting Published Performance Data . . . . . . Examining Graphics Interactions . . . . . . . . . . HP's Graphics Library Optimizations . . . . . . . Documentation Sources . . . . . . . . . . . . . Online Documentation . . . . . . . . . . . . . .
6. Writing HP PEXlib Programs Introduction . . . . . . . . . . . . . . . . . . . . . . . Determining A Server's Features . . . . . . . . . . . . . PEX Extension Information . . . . . . . . . . . . . . Enumerated Types . . . . . . . . . . . . . . . . . . Enumerated Types List . . . . . . . . . . . . . . . . Implementation-Dependent Constants . . . . . . . . . . PEX Extensions . . . . . . . . . . . . . . . . . . . . Generalized Structure Elements (GSEs) . . . . . . . . . Escapes . . . . . . . . . . . . . . .
Using Indexed Colors . . . . . . . . . . Alpha Blending and Transparency . . . . . Screen-Door Transparency . . . . . . . . Alpha Transparency . . . . . . . . . . . Implementation of Alpha Transparency . . Renderer Attributes . . . . . . . . . . . Pipeline Context Attributes . . . . . . . Color Types . . . . . . . . . . . . . . With-Data Primitives . . . . . . . . . . Output Command . . . . . . . . . . . Behaviors . . . . . . . . . . . . . . . Setting Up An Alpha Blending Program . . Anti-aliasing . . . . .
Colormap/Visual utilities . . . . . . . . . . System Requirement/Release Dependencies . . Compatibility Issues . . . . . . . . . . . . . The Multi-bu ering Extension (MBX) . . . . . Evans & Sutherland Escapes for Double-Bu ering Evans & Sutherland Escape Requests . . . . . HP Escape Request . . . . . . . . . . . . . Inquiring Supported Escapes . . . . . . . . . Structures . . . . . . . . . . . . . . . . . . Floating Point Formats/Conversions . . . . . . Lighting, Shading, and Depth Cueing . . . . . .
PEXlib Explicit Interface . . . . . . . . . . . . . . . PEXlib Output Command Context (OCC) Interface . . . . Flexible Data Formats . . . . . . . . . . . . . . . . Data Alignment . . . . . . . . . . . . . . . . . . Output Command Context (OC Context or OCC) . . . Data Structures . . . . . . . . . . . . . . . . . . . Sample Usage of the OCC . . . . . . . . . . . . . . Facet/Vertex Data Formats . . . . . . . . . . . . . . Packed Data Format (PEXlib 5.1 method) . . . . . . . Stride Data Format . . . . . . . .
PEXHPEscapeOpcodeEVEInformation Syntax . . PEXHPEscapeOpcodeEVEInformation Parameters PEXHPEscapeOpcodeEVEInformation Description PEXHPEscapeOpcodeEVEInformation Example . Plane Mask and Drawing Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-38 7-39 7-39 7-40 7-41 8. HP PEX 5.1v4|More Selected 5.2 PEXlib Functionality and HP Extensions Overview of HP PEX5.1v4 . . . . . . . . . . . . . . . . . Background Information . . . . . . . . . . . . . . . . .
PEXExtTMCoordQuadrilateralMesh: Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-23 9-24 9-24 9-25 9-26 9-27 9-30 9-31 9-31 9-31 9-32 9-32 9-33 9-34 9-35 9-35 9-35 9-36 9-36 9-36 10. Texture Mapping Tutorial Creating and Editing Textures . . . . . . . . . . . . Sources of Textures . . . . . . . . . . . . . . . . Prede ned Textures . . . . . . . . . . . . . . . .
User Interface Considerations for Creating Filtered Texture Maps . . . . . . . . . . . . . . . . . . . . . . . Troubleshooting . . . . . . . . . . . . . . . . . . . . Frequently-Asked Questions . . . . . . . . . . . . . . Texture Maps . . . . . . . . . . . . . . . . . . . . Surface Parameterization . . . . . . . . . . . . . . . Standard Mapping . . . . . . . . . . . . . . . . . . Environment Mapping . . . . . . . . . . . . . . . . . Performance . . . . . . . . . . . . . . . . . . . . . Visual Quality . . .
Figures 1-1. 1-2. 1-3. 1-4. 2-1. 6-1. 7-1. 7-2. 7-3. 7-4. 8-1. 10-1. 10-2. 10-3. 10-4. 10-5. 10-6. HP PEX Online Information System's Front Page . . . . . . The Tutorial Lets You Practice and Experiment . . . . . . On-Line Reference Pages Feature Hyperlink Navigation . . . Easily Experiment with Programs . . . . . . . . . . . . . The Print Menu Display . . . . . . . . . . . . . . . . . ET Line Types . . . . . . . . . . . . . . . . . . . . . Stride model, with vertex data . . . . . . . . . . . . . .
Tables 1-1. 1-2. 2-1. 3-1. 3-2. 3-3. 4-1. 4-2. 4-3. 4-4. 6-1. 6-2. 6-3. 6-4. 6-5. 6-6. 6-7. 6-8. 6-9. 6-10. 6-11. 6-12. 6-13. 6-14. 6-15. 6-16. 6-17. 6-18. Visual Types Supported by HP PEX/PEXlib . . . . . . . . Visual Types Supported in the X Protocol Mode (VMX Driver) Server Files . . . . . . . . . . . . . . . . . . . . . . Progression of Protocol Selection . . . . . . . . . . . . . Environment Variable Summary . . . . . . . . . . . . . Data Values That Cause Problems . . . . . . . . . . . .
6-20. 6-21. 6-22. 6-23. 6-24. 6-25. 6-26. 6-27. 6-28. 6-29. 6-30. 6-31. 6-32. 7-1. 7-2. 9-1. 10-1. HP PEX Font File Structure . . . . . . . . . . . . . . . 6-57 hfonts i/usascii/stroke fonts . . . . . . . . . . . . . . 6-59 hfonts i/usascii/stroke fonts . . . . . . . . . . . . . . 6-59 hfonts i/hp_japanese/stroke fonts . . . . . . . . . . . . 6-60 Marker Type Additions . . . . . . . . . . . . . . . . . 6-61 DBE Entry Points . . . . . . . . . . . . . . . . . . .
1 1 An Overview of the HP PEX Product The HP PEX Product The HP PEX product brings high-performance, full-featured 3D graphics through the X server to the HP 9000 Series 700 workstations. PEX is composed of two parts: PEX : Technically, PEX is only a protocol|a set of rules that an implementation follows. PEXlib : This part is a set of subroutines that follow the rules de ned in the PEX protocol. The name \PEX" is often used to refer to the above two entities as a unit.
1 X terminal that does not support the PEX extension, HP PEXlib can generate X protocol. HP PEXlib does not support raw-mode graphics (no-windows mode). For displaying pictures, HP PEX supports immediate-mode, structure-mode, and mixed-mode rendering to local and remote displays. Several capabilities serve animation and visualization applications; for example, MBX (multi-bu ering extension), texture mapping capabilities, alpha transparency, and others.
1 Supporting Selected PEX 5.2 Functionality and HP Extensions HP PEX releases 5.1v3 and 5.1v4 include some functionality and interfaces from the future PEX/PEXlib 5.2 standards, as well as extensions designed by HP. These features are being implemented in advance of the nal standards, because HP believes that they will have signi cant value in many PEXlib applications. In some cases, minor di erences between the HP implementation and the nal PEX 5.
1 Some devices enable you to create transparent overlay planes that are useful, for example, to add annotations that \ oat" over images rendered in the image planes. As mentioned, the HP PEX Developer's environment is bundled with the HP-UX Developer's Toolkit or the ANSI/C HP-UX Developer's Toolkit for the header les and development tools for the X Window System Version 11, Release 6, that are included. 1-4 An Overview of the HP PEX Product FINAL TRIM SIZE : 7.5 in x 9.
1 Supported Environments When running to a Hewlett-Packard server, an HP PEX client not using the X protocol mode supports only the visual types shown below (as returned by the Xlib call XGetVisualInfo). These are image visuals and overlay plane visuals, not pixmap drawables. Table 1-1.
1 When running to a Hewlett-Packard server, the X protocol method of producing PEX graphics supports only the visual types shown below (as returned by the Xlib call XGetVisualInfo). These are image visuals and overlay plane windows, not pixmap drawables. Table 1-2.
1 Information At The Speed Of Sight! The HP PEX product lets you learn about the industry standard as well as access reference information so you work quickly and easily|displaying it all on your workstation: Figure 1-1. HP PEX Online Information System's Front Page The on-line PEX-related documentation on your system is for the PEX 5.1v4 release; it includes information on standard PEX, as well as HP's extensions to PEX.
1 How to Access the HP PEX On-Line Information System 1. To access the HP PEX On-Line Information System , simply click on the Help Manager on the HP CDE Control Panel: 2. When the help window appears, scroll down unto \HP PEX" is visible. Click on the PEX Cube, then the underlined \Online Documentation" text. The PEX Online documentation will appear. You can also bring up the on-line documentation by running the script hvhelp i1/bin/pexman, with no arguments, from the command-line prompt.
1 The Tutorial Gets You Started . . . The on-line tutorial portion of the HP PEX On-Line Information System is designed to let you learn and even practice the essential steps that PEXlib applications must take to draw pictures: Figure 1-2. The Tutorial Lets You Practice and Experiment An Overview of the HP PEX Product FINAL TRIM SIZE : 7.5 in x 9.
1 The tutorial enables you to run all the examples from PEXlib Programming Manual . Code from these examples can also be copied and pasted into your own programs to speed development. Many other examples and utilities are also provided, including documentation about the new functionality released in HP PEX 5.1v4, and tutorial information on texture mapping. 1-10 An Overview of the HP PEX Product FINAL TRIM SIZE : 7.5 in x 9.
1 Reference Information Fast . . . The HP PEX On-Line Information System also provides convenient access to reference information. You can select a PEX function, a typedef, or a #define, use the keyword search, or simply click on the name of the command you need, and the reference page is displayed. Figure 1-3. On-Line Reference Pages Feature Hyperlink Navigation An Overview of the HP PEX Product FINAL TRIM SIZE : 7.5 in x 9.
1 Access to Performance Hints From the \Welcome to HP PEX!" window, select Performance Hints from the list of available options. Performance tuning hints have been added to on-line documentation. This documentation is intended to be used by application developers who don't have access to HP support channels to tune applications independently. The purpose of this feature is to add su cient detail, and make it accessible to customers so that they can tune applications themselves.
1 How to Run Examples and Demos The on-line system enables you to run the examples from the PEXlib Programming Manual . From the topic entitled \Getting Started with PEX" (under \PEX Tutorial"), click on the underlined hypertext link at the bottom of the page to run PEX programs: \(Click here to run PEX programs)." You are presented with a list of the example programs from Chapter 3 of the PEXlib Programming Manual : Figure 1-4.
1 This enables you to experiment with the programs; running and editing them to see the e ect of settings as you change them and revert the programs to their original state|all without having to manually copy the programs and recompile them . These examples can also be copied and pasted (used as utilities) in your own PEXlib programs to speed development. Many other examples are also available in the hpex i directory 2 to use as a source of utilities from HP.
2 Installation And Setup Introduction If you are setting up a new workstation, all software may be preloaded for you with the Instant Ignition option and you need simply verify this. If, however, you did not order Instant Ignition, then you will need to install the PEX lesets from the HP-UX Developer's Toolkit. Special Considerations for the HP-UX 10.0 Release HP-UX 10.0 is the rst release of HP-UX to support the UNIX V.4 le system.
HP-UX and Older HP PEX Applications Running on a More Recent HP-UX 9.07 System 2 The following issue should be considered before you run an HP-UX 9.01, 9.03, or 9.05 HP PEX application on an HP-UX 9.07 system. If your PEX application was created prior to the HP-UX 9.03 release, the application may exercise new paths through its source when using the TrueColor visual. To avoid compatibility problems, an environment variable has been included in X Windows for the HP-UX 9.03 and 9.05 release only .
HP-UX 9.05 or 9.07 X Windows Applications Running on HP-UX 9.01 or 9.03 The following list of items should be considered before you run an HP-UX 9.05 or 9.07 X Windows application on an HP-UX 9.01 or 9.03 system. If you create an HP-UX 9.05 or 9.07 X Windows application that uses the Multi-Bu ered X extension (MBX) and try to run it on an HP-UX 9.01 or 9.03 system, the application will not work. If your HP-UX 9.05 or 9.07 X Windows application links libXext.l, it will not run on an HP-UX 9.01 or 9.
Installation/Verification Instructions Is Your System Software Preloaded with Instant Ignition? 2 Your workstation is preloaded with software, which may include HP PEX, if it was ordered with the Instant Ignition option. A yellow label attached to the workstation in its shipping carton con rms the workstation is preloaded: Important This product contains preloaded software. Do not initialize internal hard disk drive.
Note Depending upon your hardware and colormap settings, you may experience \color ashing," something that is described in \Using SB_X_SHARED_CMAP" in Chapter 3. If there are other problems running this test graphic, subsequent error messages will point you to a solution. If HP PEXlib is not preloaded for you, skip to the section \Color" in Chapter 6, and the instructions \To Load HP PEX" in this chapter. Installation And Setup FINAL TRIM SIZE : 7.5 in x 9.
Setting Up the On-line Information System If you are using the CDE environment, no additional e ort is needed to install the HP PEX On-Line Information System . However, you may wish, for example, to change the appearance or color of the on-line information windows, or setup a Postscript printer. 2 How to Print On-Line Information Printing of the on-line pages will be to your default printer.
How to Change the Appearance of your On-Line Display The les that control the appearance of the on-line information with CDE Help are contained in the directory. List the application default les, Help*. The Helpview le speci es the size, color, and fonts used in displaying the on-line information. Using a Font Other Than the Default A default font is provided.
Information for HP-UX 9.0x System Administrators To Load HP PEX 2 If you have a 9.0x release of HP-UX, and your workstation is not preloaded with Instant Ignition, you must install HP PEX (usually from a CD-ROM or DDS tape or over your company network), which requires superuser capability. (If you have HP-UX 10.0, PEX is bundled with other products, so no explicit PEX installation is necessary.) 1. Check that the workstation is running the HP-UX operating system, 9.
If you are using X Windows with some other window manager, stop the server (usually this is done by typing 4Shift5 4CTRL5 4Reset5) and then restart it. If You Experience Difficulty During Installation Check for any error messages that were recorded in the le /tmp/update.log (make sure you check the dates and times printed in the le so you know which update session the error messages refer to). Also check the messages that may have been displayed from running verify_install. Also check the device les.
If You Reinstall the HP-UX Operating System If, for some reason, you must reinstall the HP-UX operating system, you must also reinstall HP PEX. 2 Caution 2-10 HP PEX replaces some HP-UX 9.0/9.01 graphics lesets, so in those cases where it is necessary to reinstall your operating system, you will need to reinstall the HP PEX product lesets as well. Installation And Setup FINAL TRIM SIZE : 7.5 in x 9.
The HP PEX File Structure This section contains information about some of the les shipped with the PEX product that is important for you to know before you begin working with HP PEX. The PEXlib Filesets The PEXlib leset lists are found in the /etc/filesets directory under HP-UX 9.0x and are accessible via the swlist command under HP-UX 10.x . Listing the les in this directory that begin with PEX5 will help you understand the structure of HP PEX.
Server Files There are a number of les that specify or a ect the operation of the HP PEX server processes and are located in various directories4: 2 Table 2-1. Server Files File libXhpPEX.1 pexd XErrorDB This le, in /usr/lib/X11/extensions, contains the server libraries. This le, in hpexd i, contains the PEX server program. This le, in /usr/lib/X11, contains the basic and standard X error messages. fp.
3 Running HP PEXlib Programs Introduction This chapter describes the characteristics of HP PEXlib programs as they run on HP workstations. The PEX protocol de nes the way information is exchanged between clients and servers. Clients send encoded requests to the PEX server and the server generates events, replies, and errors.
This le contains important information about the HP PEX product that was not available in time for printing the hardcopy documentation. This includes information about utility programs that conveniently perform common operations and which aid interoperability of programs. Also look in the README les that may be found in the various directories and subdirectories of the HP PEX product. 3 3-2 Running HP PEXlib Programs FINAL TRIM SIZE : 7.5 in x 9.
Operating Methods This section describes di erences in how the client application can control the way rendering is performed through the HP PEXlib interface. There are three basic methods that PEXlib can assume: DHA, PEX, or X. You make the selection via the type of X display connection (normally speci ed with the environment variable DISPLAY) and the environment variable HPPEX_CLIENT_PROTOCOL.
De nitions for the terms that appear in the following table are explained here: Definitions Used In Table 3-1 hlocal host hremote 3 host i:n .n Indicates the client has connected to a server on the local machine, the same machine the client is running on. Indicates the client has connected to a server on the remote machine, a machine other than one the client is running on.
Table 3-1. Progression of Protocol Selection HP PEX Client Protocol X Display Variable unix:n .n local:n .n hremote or host i:n .n or shmlink: n .n or hlocal host i:n .n hdefault i1 DHA!PEX!X!Error DHA DHA!Error PEX PEX!Error X X!Error PEX!X!Error 3 Error PEX!Error X!Error 1 If the HPPEX_CLIENT_PROTOCOL environment variable is not set (or is set to an unrecognized value), PEXlib selects the method for best rendering performance.
Visible Behavioral Differences of DHA Method 3 A client may want to use DHA method (and will get DHA method by default on a local machine) for performance reasons. However, since DHA method does not generate any PEX protocol requests, some minor behavioral di erences may be observed. The di erences are listed here along with a brief explanation: Request Sequence Numbers Reported by Errors |Normally, each X/PEX protocol request is tagged with a sequence number when it is sent to the X server.
PEX Protocol Method PEX protocol method provides the best performance in distributed graphics environments when a PEX-capable server is available, i.e., when the client and server are on di erent systems and the remote X server has initialized the PEX extension. In this method, PEX protocol is transmitted over the network to the remote server. Performance is dependent upon factors such as network loading, bandwidth, and the type of network.
Visible Behavioral Differences of X Protocol Method All the comments pertaining to the DHA method are also applicable to X Protocol method, plus the following additional di erences: PEX Extension Initialization |Normally, a PEX extension is supported by the server and a corresponding structure is created on the client side when the PEX extension is initialized.
Setting and Using Environment Variables This section provides instructions for setting and controlling the environment variables that you can use to con gure the PEXlib client. To assure interoperability, your program should look for the existence of environment variables, since these variables are implementation-dependent, in order to use them as program parameters. If these do not exist, then the program uses default values.
Table 3-2. Environment Variable Summary (continued) Range of Values Environment Variable Name HPPEX_DHA_COMPLIANCE_MODE h SB_X_SHARED_CMAP 3-10 any valuei; e.g., This variable enables complete PEXlib compliance with the o cial standard speci cation. Because this variable must be set in order to cause complete compliance, HP PEXlib runs in the highest-performance mode by default. If your application cannot tolerate any di erences from the standard, then set this variable.
Table 3-2. Environment Variable Summary (continued) HP_DISABLE_COLOR_RECOVERY h HP_ENABLE_TRANSPARENT_MODE h HP_COUNT_ TRANSPARENT_IN_ OVERLAY_VISUAL HPPEX_TXTR_SHMEM_THRESHOLD Description Range of Values Environment Variable Name any valuei; e.g., When this variable is set to any value before PEXBeginRendering or other similar entrypoint that binds the renderer to the window, the color recovery feature is disabled.
How To Set Environment Variables There are two ways to set environment variables. The choice depends on whether you are using HP CDE or if you are simply using the X environment.
Using Environment Variables Environment Variable|To Specify Color Color resources are set using color names either from the X11 color database rgb.txt, or using the syntax #RedGreenBlue where Red , Green , and Blue are hexadecimal numbers containing 1, 2, 3, or 4 digits (that is, #rgb , #rrggbb , #rrrgggbbb , and #rrrrggggbbbb are all legal syntaxes). These hexadecimal numbers indicate the amount used of that primary color. There must be the same number of digits for each of the primary colors.
Environment Variable|PEX Protocol Method When using the PEX Protocol Method of connecting to the server, (that is, you have set HPPEX_CLIENT_PROTOCOL to PEX), you must reset the following environment variables, if you wish to use them, before the X server is started on the PEX server's system for the variables to have an e ect: 3 HPPEX_DHA_ECHO_COLOR HPPEX_DHA_HIGHLIGHT_COLOR HPPEX_DHA_COMPLIANCE_MODE HPPEX_DHA_AUTO_COLOR_APPROX Setting these variables before starting the client process will not a ect t
Because invalid data can cause programs to fail, Hewlett-Packard suggests the compliance mode variable be set during development of the application, and unset once the application is defect-free. The precise performance di erences with the mode set and unset vary with the application. The application documentation should specify whether or not this variable should be set.
Using SB_X_SHARED_CMAP On graphics devices with only one hardware colormap, PEX applications may experience \color ashing." Color ashing is the condition where colors displayed on the workstation screen change as the focus moves from X window to X window and where the PEX image looks correct only when the focus is in its window. 3 This is common on low-end graphics devices because most PEX applications are demanding in their color usage, more demanding than many other X clients and window managers.
value of the variable at the time the PEX application is started controls the color approximation support.) SB_X_SHARED_CMAP is especially important if you have PEX applications that need to share a colormap (perhaps the default colormap) with other X clients. In such a case, it is common for the X clients and window managers to be using pixel values in the low end of the colormap, for X rendering and for borders and backgrounds.
Note 3 If your PEX application does not require the higher 8j8j4 color resolution, set your SB_X_SHARED_CMAP environment variable to \True" on these lower-end graphics devices. Be aware that this may result in aberrant color behavior on the part of other colordemanding X applications as discussed above. However, setting the environment variable will allow many PEX applications to share a colormap with other clients, avoiding the \color ashing" problem.
Environment Variable|Color Recovery In order to provide higher-quality shaded images on low-cost 3D graphics systems like the Model 712, as well as the HCRX-8 devices, you can take advantage of a new feature called color recovery . Color recovery provides better pictures on low-cost workstations than are possible using only dithering by attempting to eliminate the apparent graininess caused by dithering.
Environment Variable|Turning Off the TrueColor Visual TrueColor visuals are supported with 9.05 release and later releases of HP-UX. Note that applications created prior to the 9.03 release of HP-UX may exercise new paths through their source when using this visual. To avoid compatibility problems, an environment variable has been included in X Windows for the HPUX 9.03 and 9.05 release only .
To unset the environment variable, remove this line: Dtlogin*environment:HP_SUPPRESS_TRUECOLOR_VISUAL=TRUE from your Xconfig le and restart the X11 server. 3 Running HP PEXlib Programs FINAL TRIM SIZE : 7.5 in x 9.
PEX Fonts PEX fonts are separate from X fonts in the HP implementation. The PEX fonts are located in the hpex-fonts i directory 3. The way the server nds PEX fonts is through the X font-path mechanism. The application must be careful when manipulating the X font path; it is possible to leave PEXlib client applications without fonts. Just as with Xlib, the burden is on the client application to be a good X font-path citizen.
Parameter Error Checking and Reporting The HP PEXlib client, when emitting PEX protocol, does no parameter error checking. The standard PEX method is for the server to detect parameter errors in incoming protocol requests and report them to the client. If DHA rendering is being used, or the X protocol method is in e ect, parameter error checking will be done in the client process. Error reporting is handled di erently when in the DHA and client process methods versus the PEX protocol method.
The Effects of Client Failures The most common situation in which one PEXlib client can adversely a ect another occurs when a client passes bad values in its data. This may cause a server to dump core, thus a ecting all the clients connected to that server. However, the e ects of this vary according the connection method of the PEXlib client|whether DHA, PEX, or X. 3 In the PEX method, a client can send bad oating-point data values to the PEX server, causing it to abort and a ecting all other PEX clients.
generated data is prone to producing these \toxic numbers." If this occurs, your displayed images can appear with unexpected results. To avoid this situation, your application must not generate these three conditions or must lter these conditions from their data. 3 Running HP PEXlib Programs FINAL TRIM SIZE : 7.5 in x 9.
FINAL TRIM SIZE : 7.5 in x 9.
4 Utilities, Compiling And Linking, Examples and Demos Introduction The PEXlib Programming Manual , Chapter 3, \Getting Started", and the on-line version of Chapter 3, HP PEX On-Line Information System , both illustrate the general steps for creating and running PEXlib programs. Speci cs are included in the on-line documentation, where source code is compiled; see the make les for details.
Listing the contents of the hpex i directory 1, you will see a number of important subdirectories, including: Table 4-1. Demos, Utilities, and Program Examples 4 1 Subdirectory Description demos Contains programs that demonstrate 3D capabilities of HP PEX. The PEX veri cation program verify_install, for example, is included here. hhp-examples i The program examples in this directory illustrate ways to achieve special graphics e ects using PEXlib calls.
Including Header Files In Your Applications HP PEX uses standard C and X11 header les, providing de nitions and declarations shared among program les (list the hpex incl i directory 2). Most, if not all programs, will require that at least these header les must be included at the beginning of your programs. Your program may require others in addition to these. #include #include #include #include #include #include
Another example is the colormap and visual utilities that require you to include PEXUtCmap.h from the hcge utils i3 directory. This header le de nes the constants and structure types for use with these utilities. Instructions for including various additional header les are usually provided with the README le that accompanies the utility or function. The README also includes instructions for using or operating the utilities. Table 4-2. Header Files for Advanced Functionality 4 File1 Description PEXHPlib.
Using the Utility Programs A number of utilities have been added to the HP PEXlib product that simplify and speed programming or which enable you to display sophisticated images. Utilities For The Common Graphics Environment To encourage and assist you in the development of applications based on the common graphics interoperability conventions, a number of highly recommended utilities are made available in the directory hcge-utils i4: PEXUtCmap.c PEXUtCmap.h PEXUtCmapint.c PEXUtCmapint.h PEXUtExt.
Utilities from Hewlett-Packard Hewlett-Packard ships a number of additional utilities with the HP PEX product. These utilities are in the hpex utils i directory 5. See the README le in this directory to learn about these utilities and how they are useful. Table 4-3. HP Utilities in Utilities Directory Subdirectory 4 5 Description PEXSimple.c A basic Motif widget for a PEX drawing area. hpgamma.c An HP utility to enable gamma-correction for anti-aliasing. pexutcmap.c pexutcmaphp.c pexutcmapint.
Examples, Utilities and Demo Programs The HP PEX product contains many examples and programs, in addition to those supplied with the O'Reilly PEXlib Programming Manual , that demonstrate use of various functions and utilities that can make you more productive or to display more sophisticated images. The hpex i directory contains the examples and demos.
hhp-examples i/widgetdemo|Demonstrates creation of XgPEXSimple Motif widget, displays dotted line in it, and provides a pulldown menu to close it. hhp-examples i/wideline_ctl.c|Demonstrates the control of stroked versus lled widelines. hhp-examples i/polyoff/polyoff_ctl.c|Demonstrates use of the polygon o set performance feature. Using the HP Examples The le6 hhp-examples i/README describes how Makefile is used to build executable programs of the various examples included in the directory.
This table summarizes the shared libraries and X11 directories that are linked on the command line example above. Table 4-4. Shared Libraries and X11 Directories Library Description libX11 X11 routines X11 extensions PEXlib routines math functions libXext libPEX5 libm 4 Utilities, Compiling And Linking, Examples and Demos FINAL TRIM SIZE : 7.5 in x 9.
FINAL TRIM SIZE : 7.5 in x 9.
5 Performance Hints Steps to Getting Good 3D Graphics Performance As an application developer, one of your primary concerns is designing and tuning your application so that it runs at full performance on supported platforms. On HP graphics systems, a simple technique can be applied to graphics-intensive applications that will help you accomplish this goal. The rst step in this process is to choose appropriate hardware and software for the application that you will be running.
Identify SPU and Graphics Hardware Suited For the Application Your choice of a hardware platform will depend on the type of application you are planning to support. For example, will end users spend only a small amount of time creating a model, but spend most of their time rotating objects and viewing them from di erent directions? If so, the graphics hardware may be the more important consideration.
Graphics Benchmarks The Graphics Performance Characterization committee (GPC) provides a set of Picture Level Benchmarks (PLBs), which are a standardized, vendor-independent measure of graphics performance. The benchmarks are run from the PLB interpreter program, which executes a series of graphics calls. A number of data sets, which contain graphics calls that a typical application might make, are provided by the GPC committee.
Is rasterization of primitives accelerated? If it isn't, rendering times are strongly impacted by window sizes. How does the graphics system interact with the CPU? If the graphics computations are done completely by the graphics device, graphics performance will not scale with a faster CPU. If the mathematical computations are done in the CPU, instead of by specialized graphics hardware, graphics performance will scale with CPU performance.
Choosing a 3D Graphics Application Programmer Interface HP supports several graphics application programmer interfaces (APIs). Your choice of API will depend on the features of the API, as well as performance. PEX is a vendor-independent extension to the X Window System that is supported by major workstation vendors including HP, Sun, IBM, and DEC. PEXlib is the corresponding API that generates PEX protocol.
Determining How the Application is Using System Resources Choosing an Effective Benchmark To accurately verify whether or not your application is reaching maximum performance levels, you will need to run some benchmarks. An e ective benchmark focuses on the critical functionality of the application.
Identify the Bottlenecks If the use of system resources is not balanced by the application, performance can slow down considerably. Performance bottlenecks can occur in many di erent places in your applications, including: graphics, the CPU, memory, the network, and I/O systems. For example, an application that does extensive mathematical computations on data before displaying that data may be CPU-bound.
Performance Analysis Tools Several HP-UX tools are available to help you determine how the system resources are being used. /bin/time is a UNIX command that can be used to run a program and determine what percentage of time is being spent in user code and what percentage is being spent in the system. For example, running a demo program from the PEXlib Programming Manual produced these timing results. $ /bin/time night-time real 15.2 user 11.4 sys 0.
HP/PAK, the HP Performance Analysis Kit, consists of three tools that help you analyze the performance of your applications. Each of the tools examines program performance at a di erent level of detail. XPS looks at the relative use of system resources by all processes at the system level. DPAT is an interactive tool that looks at the performance of a process at the procedure level. HPC looks at the performance of compute-bound procedures at the statement/instruction level. In HP-UX 10.
Profiled PEXlib If you have HP-UX 9.07 or 10.10, and have installed HP-PEX 5.1, Version 3.0 or later, a pro led archive library containing the highest level of PEXlib calls is shipped in hpro le i1. To get additional information about time spent in PEXlib calls, add libPEX5_prof.a to your link line, as shown in the example below. cc -DHPPEX_PROCEDURES program.
by one sequence of attribute calls, but not rendered according to published speci cations when preceded by another set of attribute setting calls. Extracting the calls gives you an easy way to view the sequence of graphics operations as performed by your application. Interpreting Published Performance Data One way to determine if your application's graphics performance is reaching acceptable levels is to compare your benchmark results with the published gures from the Product Data Sheet for your system.
HP's Graphics Library Optimizations All HP-UX graphics products are tuned for maximum performance based on typical application usage. In other words, there are some combinations of primitives and attributes that HP graphics libraries will execute faster than other combinations of primitives and attributes. In order to determine what those paths are, you need to study the available documentation for each release.
Studying Optimizations Shown in the GPC Quarterly In general, PLB benchmarks are most useful for comparing systems before purchase. However, there is one piece of information in the GPC Quarterly that is helpful to application developers for performance tuning. Published with a summary of the GPC results is a description of the optimizations made by the vendor to achieve maximum performance for the benchmark.
Attribute Suppression Experiments It is relatively simple to determine whether or not you are setting attributes correctly in order to execute the optimized paths in the graphics libraries. Run your benchmark on your application as it is currently written and record the timing results. Then, experimenting with one attribute call at a time, suppress the attribute calls (that is, comment out the function calls) in your benchmark and rerun it. Compare the timing results.
PEXlib Surface Attributes: PEXSetReflectionAttributes PEXSetInteriorStyle PEXlib Color Attributes: PEXSetLineColor PEXSetLineColorIndex PEXSetMarkerColor PEXSetMarkerColorIndex PEXSetSurfaceColor PEXSetSurfaceColorIndex PEXSetTextColor Other PEXlib Calls You Should Experiment With PEXSetFacetCullingMode PEXSetFacetDistinguishFlag PEXSetLineWidth If your application does not set attributes redundantly, then it might be that your application is setting attributes in a way that is not optimized in the libra
Determining how changes in data formats are a ecting your overall application performance is more di cult than the attribute experiments described above. You will need either to sort the data passed to PEXlib or to perform multipass rendering using your data. To sort data, you would need to group all of the geometry with identical vertex attributes and render it all at once. In a multipass rendering, you would need to traverse the data several times.
Geometry Suppression Often the amount of detail in the geometric model is greater than the amount of detail needed to render an object realistically. By experimenting with geometry suppression you may also be able to improve application performance. In this case, your application does not render all of the geometry available. Two general techniques can be applied to many graphics applications. In the rst, multiple variations of the geometry are used.
Structure Mode, Immediate Mode In PEXlib, there are two ways to draw a scene. If you are using immediate mode, you can pass all of the primitives and attributes in the scene to PEXlib one at a time, each time you want to draw the picture. In structure mode, you store all of the primitives and attributes in a graphics database, then tell PEX to render the contents of that database.
Structure Permissions Structure permissions control the access to structures by applications. By calling PEXSetStructurePermission, an application can set the permission of a structure to either PEXStructureWriteOnly or PEXStructureLocked. Writeonly structures cannot be read by PEXFetchElements, and locked structures cannot be edited.
Stride and OCC vs. PEX 5.1 Interface PEXlib o ers two major argument interfaces for output commands (primitives and attributes): an explicit interface and an output command context interface (OCC). The explicit interface requires that you specify the display, resource ID (renderer or structure), and request type for every output command function call that you make. The explicit interface is the only interface available on PEXlib 5.1 (including HP-PEXlib, Versions 1.0 and 2.0).
Data Formats If your application is running in DHA mode on HP, the selection of data interface may have a signi cant impact on performance of your application performance. The OCC interface is implemented at the PEXlib level; the protocol generated by the OCC interface is identical to the protocol generated using the 5.1 PEXlib interface. Consequently, performance is only a ected when running in DHA mode. HP-PEXlib is optimized to use the packed and stride data interfaces most e ciently.
Use of Complex Primitives Best performance on the newer graphics products can be achieved by reducing the CPU \non-graphics" overhead, such as procedure call overhead. Applications can reduce overhead by packing more primitives into library calls. In HP-PEXlib 5.1, Version 3, a number of complex primitives are supported. However, just using those primitives is not enough. Applications must send enough primitives per call to amortize the overhead.
Compiler and Linker Options If your application is CPU bound, you may be able to substantially improve performance just by compiling and linking with some optimization options. For example, compiler options can automatically remove dead code, make better use of registers, optimize loops, generate in-line code, optimize for a particular architecture (for example, PA RISC, Version 1.0; or PA RISC, Version 1.1), and optimize your application based on a run-time pro le.
Memory Bottlenecks 5 If memory is the bottleneck and your program is thrashing (that is, pages of virtual memory are excessively swapped into physical memory), you may be able to improve application performance just by increasing the amount of physical memory in your system. You can also tune your application's memory usage. To do this, consider the following, all of which will require some code changes in your application: Improve locality within your program.
Summary Good graphics application performance depends on a number of factors, including the raw performance capabilities of the graphics hardware and software used by the application; the e cient, balanced use of system resources; and calling sequences that use the most optimized paths through the graphics libraries. Each application is di erent. No single set of rules will provide optimal performance for a speci c application.
FINAL TRIM SIZE : 7.5 in x 9.
6 Writing HP PEXlib Programs Introduction This chapter provides you with recommendations and speci c details of the HP PEX implementation that a ect how you will write your programs. As a PEXlib programmer, if it is among your objectives to write programs that are portable and interoperable on a variety of workstations and graphics devices|you will want to do so without sacri cing performance.
Determining A Server's Features You can learn quite a lot about your particular system, server, and the supported X and PEX extensions with the xdpyinfo command. On Hewlett-Packard workstations this command is in the directory 1 hcontrib i/bin/X11. See sample output in Appendix A.
This also tells what version of protocol is supported by the PEX server as well as other information that can be used for error handling. PEXlib functions that have a display parameter are not allowed to be called before calling PEXInitialize . If the application calls a PEXlib function that is not allowed to be called before PEXInitialize is called, HP PEXlib will ignore the call. The following table shows the HP-speci c error codes that can be returned from the PEXInitialize function.
Table 6-2. PEXInitialize Error Codes Return Value 01 02 03 04 05 06 07 08 HP-Speci c Error Strings (The error string returned here varies according to the error condition. Print the error string which is returned in your program to learn about the actual error condition.
Enumerated Types Enumerated types de ne values used to de ne attributes such as marker types (dot, asterisk, circle, or \2"). Other examples include line type, color type, and interior style. Because a PEX server may not support all enumerated types, PEX provides the PEXGetEnumTypeInfo information inquiry for determining which enumerated types are supported by the particular server. The table below lists the enumerated types supported by HP PEX on supported graphics devices.
Table 6-3. Enumerated Type Inquiry Parameters Value Description display A valid display pointer. drawable An example drawable indicating the screen and depth of the window for which the values will be used. count The number of enumerated types. enum_types A list of enumerated types for which information is to be returned. item_mask A mask indicating the data to be returned for each type. info_count_return Returns an array of counts.
Enumerated Types List Information about HP-supported enumerated types is shown here. There are standard PEXlib inquiries which return HP-supported enumerated types. CGE PEX 1.0 also de nes additional enumerated types to list extension features for which PEXlib 5.1 does not de ne a mechanism of inquiry. For example, PEXExtETOC can be inquired to list extension OCs (Output Commands) beyond the PEXlib standard. See the PEXExt.h and PEXHPlib.h les for lists of extension enumerated types.
Table 6-4. Enumerated Types HP PEX 5.
Table 6-4. Enumerated Types (continued) HP PEX 5.
Table 6-4. Enumerated Types (continued) HP PEX 5.
Table 6-4. Enumerated Types (continued) Enumerated Type Escape (continued) HP PEX 5.
Implementation-Dependent Constants There are other PEX values in addition to enumerated types that vary among implementations, as allowed by the PEX standard. Implementation-dependent constants de ne things like the maximum value of a name or the number of line widths. The table \Implementation-Dependent Constants" below lists the constants that are supported in HP PEX.
This table lists some of the implementation-dependent constants that are supported in HP PEX. For an exhaustive list, see the include les PEX.h, PEXExt.h, PEXlib.h, and PEXHPlib.h. Table 6-6. Implementation-Dependent Constants Implementation-Dependent Constant HP PEX 5.
Table 6-6. Implementation-Dependent Constants (continued) HP PEX 5.
Escapes Extensions to PEX are provided by HP for capabilities beyond the standard. These are implemented, according to provisions in the PEX standard, in a way that makes for a common interface to the extensions which does not negatively a ect the portability of applications. The Evans & Sutherland escape requests are described in the section \Animation", later in this chapter. The section also shows an example of the syntax and return information.
PHIGS Workstation Resources HP PEX does not support the PHIGS Workstation subset because it is expected to be removed from PEX at a future version. These functions will not emit protocol and will generate a BadRequest. This table lists the PEX functions in subsets that HP PEX does not support as allowed by the standard. Table 6-7.
Resource Sharing Because X resources are global in the server, X window applications have been able to share resources between processes by passing the resource ID through some inter-process communications mechanism. HP PEX does not support sharing of PEX resources. Synchronization All the normal requirements for achieving proper ordering of rendering and windowing operations in X programs also apply to PEXlib programs.
HP PEXlib Programming The remaining sections of this chapter are arranged to supplement the information in the same order that it is presented in the O'Reilly PEXlib Programming Manual . The sections are in order, beginning with the following section, \Color". Color This section begins with a general discussion, a quick primer, on the basics of PEX color support, and follows with a more detailed discussion of the speci cs of the HP implementation.
Color is an important element in shaded images such as those typically drawn via PEX. A PEX application may be more \demanding" in each of these steps than a simple X application. The colormap that is used by your HP PEXlib program must be consistent with the color approximation speci ed in your program. The colormap's interpolation ramp and the color approximation describing that ramp are limited by the visual selected, which in turn are limited by individual vendors or graphics devices.
It is wise to use PEXMatchRenderingTargets when using a PEX 5.1 server, because this routine lets the application know positively whether or not a visual is supported by PEX. Ready-made solutions to the visual selection problem and other problems are available in the utilities directories under hpex i3 . They contain a number of utilities to help programs select visuals as well as resolve colormap issues, and create windows for HP workstations. One such utility of interest here is PEXUtSelectVisual.
text or other graphics to the overlay window without re-rendering the image window graphics. This is especially useful for user-interface objects (menus and such) or annotation text that \ oats" over image-plane objects. These overlay planes provide lesser functionality than the image planes. The overlay planes' transparency feature enables you to render opaque objects (for example, menus and text) to a transparent overlay plane and at the same time, view rendered objects in the image planes.
colormap (see the next item in this list that discusses the colormap contents). Even if each PEX client has its own colormap resource, it is likely that the colormap contents will be very similar, and the severity of color ashing among them will be much reduced. X standard colormap properties are elements of an established convention that allows description and sharing between X clients of the kind of colormaps that are appropriate for PEX.
DirectColor and TrueColor visuals). Again, the hcge utils i directory 4 provides utilities that aid in setting up a colormap to contain a color sampling. Ideally, every PEX implementation could support any color approximation setup that is \legal." However, this is not likely to be the case and even if it were, rendering performance would be impaired for setups that were unnatural to the device.
5: Create a Window in the Chosen Visual, with the Colormap PEX adds no new tasks to this step. Assuming the visual that has been chosen is supported by PEX, and the colormap has been set up to match the color approximation, your application can create the window normally, and should then be able to create Lookup Tables and Renderers using the window as an example drawable, and/or bind a Renderer to the window for drawing or picking.
On other servers, there may only be one relatively limited visual. In such a situation, your application has two choices: It may be able to operate successfully with a limited range of colors that t into a colormap that can be shared. It may need to create a separate colormap and you (and your end user) will have to tolerate the color ashing if there are insu cient hardware colormaps to keep them all installed.
Color Support in HP PEX Now, apply these basic strategies (that your application might use for selecting a visual and setting up a compatible color approximation table and colormap contents) to Hewlett-Packard graphics workstations: If you de nitely need to coexist in the same visual with many other X clients (this applies to low-end devices that have only one visual), you can use the DefaultVisual and DefaultColormap macros (de ned in Xlib.h) to acquire the visual information and colormap ID.
Utilities To Help You Deal With Color HP PEX helps you resolve PEX color issues through the de nition of X standard colormap properties, prede ned color-approximation LUT entries that are appropriate for the HP graphics devices on which PEX programs run, and a complete set of utilities for selecting visuals, creating and loading colormaps and creating windows in the visuals. These utilities are in one of the utilities directories under the hpex i directories5.
To Get A Colormap That Supports Transparency If you need an overlay colormap that supports transparency, create the color map using the visual that includes transparency in its SERVER_OVERLAY_VISUALS property. If this property exists on the root window of a particular screen, that screen has overlay planes.
Color Approximation|Utilities And Escapes How can your application determine the particular color sampling that HP PEX supports? As discussed in Chapter 25 of the PEXlib Programming Manual , escapes provide for features not de ned by the standard PEX speci cation.
The syntax for PEXEscapeWithReply is: char* PEXEscapeWithReply( Display *display, unsigned long escape_id, int length, char *escape_data, unsigned long *reply_length_return) Table 6-8. PEX Escape With Reply Parameters Value display Description A pointer to a display structure returned by a successful XOpenDisplay call. escape_id Set to PEXEscapeQueryColorApprox. length The length, in bytes, of data for the escape request.
The input data structure (*escape_data) for PEXEscapeWithReply for this particular opcode is de ned as: typedef struct { Drawable drawable; PEXColorApproxEntry capx; } PEXEscapeQueryColorApprox; Table 6-9. Data Structure Parameters Value Description drawable The identi er of an example drawable in the correct screen and visual (similar to the drawable parameter of other PEXlib inquiries such as PEXGetEnumTypeInfo ).
The PEXEscapeQueryColorApproxReplyData is de ned as: typedef struct { char capx_is_supported; char all_capx; char reserved1[2]; unsigned long count; unsigned int reserved3[3]; } PEXEscapeQueryColorApproxReplyData; Table 6-10. Return Data Value Description capx_is_supported True indicates that the color approximation entry you sent is supported \as is." False indicates otherwise.
The set of alternative color approximation entries can be accessed by computing the appropriate pointer and using array indexing, as in the following example: Drawable PEXColorApproxEntry PEXColorApproxEntry PEXEscapeQueryColorApproxData char unsigned long PEXEscapeQueryColorApproxReplyData PEXColorApproxEntry my_example_drawable; my_candidate_color_approx; my_chosen_color_approx; query_in; *return_ptr; return_size; *query_out; *alternative_entries; (example drawable ID and candidate color approximation e
This escape can also report a BadDrawable error (if the example drawable ID is not valid) or BadValue (due to an illegal value in one of the color approximation entry elds). 6 6-34 Writing HP PEXlib Programs FINAL TRIM SIZE : 7.5 in x 9.
Table 6-11.
Making Color Approximation Inquiries The Hewlett-Packard implementation of PEX does not support arbitrary color samplings. In fact, for any given device and environment, only one color sampling (and therefore, only one particular PEXColorSpace color approximation setup) is supported. You need access to the color sampling information|you must use the escape| at the time that you load the colormap.
If your graphics device is a CRX, you will need to use the special utilities for adjusting the colormap for that hardware. Source code for these utilities is provided online and described in the README le in the hpex-utils i directory 7. Effect of Dithering Control on Color For some applications, it is desirable to disable dithering|such as nite-element analysis or data visualization that bene t from the resulting color banding e ects.
correspondence between colors you load into the PEX color lookup table, and the colors you must put in the X colormap. The rendering pipeline always operates in RGB. For this reason, PEXColorSpace is the most natural color approximation method, even for applications that use indexed colors. Alpha Blending and Transparency Alpha blending is a frame bu er operation that blends a source color with whatever color is already in the frame bu er, for each pixel in an image.
is farther away, and the user cannot see it at all. There also may be interference patterns between the screen-door cell and any dithering pattern that is in use. Alpha Transparency \Alpha" is an extra channel carried along with colors (or vertex data from which colors can be computed; for example, by lighting equations) that speci es the opacity of the color. Typically, an alpha of 1.0 indicates complete opacity, and 0.0 indicates complete transparency (i.e., the inverse of the transmission coe cient).
Implementation of Alpha Transparency Values are shown here; mnemonic strings have names derived from the value identi ers in the usual fashion. Table 6-12.
Renderer Attributes The transparency_method HP extension Renderer attribute controls the type of transparency algorithm supported by the renderer. Its default is PEXHPTransparencyMethodScreenDoor. See PEXHPChangeRenderer in the on-line documentation for information on how to set this attribute. Pipeline Context Attributes There is one new Pipeline Context attribute supported for alpha blending. The alpha_blend_function default is PEXHPAlphaBlendFunctionSrcColor.
The PEXFacetData union is most a ected since its size would be changed, though it is only passed to primitives by reference and in all cases only a single facet's worth of data is passed. However, it is embedded directly inside members of the PEXOCData union, so changing it would create an incompatibility for old programs using the PEXlib OC encoding routines. Therefore, the union has not been changed and typecasting of the pointer is necessary when calling the entry points that use this union.
Output Command The function PEXHPSetAlphaBlendFunction creates an output primitive attribute that sets the blend functions for alpha blending and alpha transparency. Unsupported values will default to PEXHPAlphaBlendFunctionSrcColor, which results in source color rendering. Also see PEXHPChangeRenderer . PEXHPSetAlphaBlendFunction( Display *display, XID resource_id, PEXOCType OCtype, int blend_function) Using this routine, parameters are as follows: Table 6-13.
This entrypoint generates an extended OC with an output command number of 0x8700. The encoding for the output command is: Table 6-14. Encoding of HP-Supported Alpha Blending Extension Extension/size Type/value 2 0x8700 2 Explanation Output command number Output command length 2 INT16 2 unused Alpha blend function Behaviors The default value of all attributes results in alpha transparency being o ; screen-door transparency is in e ect.
color, the source alpha value is carried through unchanged. After depth cueing, the alpha value is used to blend with the pre-existing frame bu er contents. On targets that do not support alpha blending (e.g., 8-plane visuals and CRX24), when the transparency method calls for alpha blending, HP PEX does not do transparency. Speci cally, screen-door transparency is not substituted for alpha blending.
Anti-aliasing HP supports two methods of anti-aliasing for producing high-quality images, most noticeable as smooth lines and polygon edges. In the rst, which was provided with HP PEX 5.1v1, anti-aliasing is provided through a GSE (see \Line Types"). However, this GSE is not the preferred method and is retained primarily for compatibility reasons. The second and preferred method, added for HP PEX 5.1v2 is an OC routine PEXExtOCSetPrimitiveAA, which selects the primitives that are to be antialiased.
The HP/CGE PEX 1.0 supported/unsupported anti-aliasing methods are: Table 6-15. PEXExtPrimAANone HP/CGE PEX 1.0 supported (default) PEXExtPrimAAPoint unsupported by HP PEXExtPrimAAVector HP/CGE PEX 1.
Line Primitives and Attributes Line Types These line types are supported: PEXLineTypeSolid PEXLineTypeDashed PEXLineTypeDotted PEXLineTypeDashDot PEXExtLineTypeCenter (CGE extension) PEXExtLineTypePhantom (CGE extension) PEXHPOCCSetUserLinetype Figure 6-1.
Utilities in the hpex-utils i directory9 include a utility procedure that you can call to create a gamma-corrected colormap. Note that gamma correction may cause some vectors to be drawn without antialiasing to appear dimmed. You should be aware of this e ect, although it is unusual for an application to enable and disable antialiasing during traversal.
To use the HP antialias mode GSE, the ID parameter should be set to HP_GSE_SET_ANTIALIAS_MODE. The data structure type name needed for the data parameter is hpGSESetAntialiasMode. The antialias_mode eld in this structure can take one of the following values: Table 6-17. Valid antialias_mode Values HP_ANTIALIAS_MODE_OFF Disables antialiasing for line primitives and for ll-area edges.
Wide-Line End Styles Cap and join style support is provided through two CGE extension OCs: PEXExtOCSetLineCapStyle and PEXExtOCSetLineJoinStyle.
NURBS Approximation Setting the curve approximation criteria to a particular value for NURBS surface trim curves has no e ect in HP PEX. Trimming curves are automatically computed with a resolution compatible with the surface approximation criteria. The parametric surface characteristics attribute can be set to either of two values: PEXNone or PEXPSCImpDep .
PEX de nes model clipping, but does not address capping or interference checking. Responding to customer request, HP developed an interface to provide access to these features through PEXlib. This interface supports the de nition of volumes independently of the primitives or structures used to de ne them. The interface is implemented with the procedure PEXHPSetCappingPlanes (see the reference page in the on-line documentation). This entrypoint is implemented as an Extended Output Command (extended-OC).
The following CGE PEX 1.0 extended area primitives will accept deformation values in the vertex data: PEXExtFillAreaSetWithData PEXExtTriangleStrip PEXExtQuadrilateralMesh PEXExtSetOfFillAreaSets These primitives are de ned in the CGE PEX 1.0 speci cation. Existing 5.1 area primitives (PEXFillAreaSetWithData, PEXTriangleStrip, PEXSetOfFillAreaSets, etc.) are una ected by the deformation mode. The HP extended primitives PEXHPPolylineSetWithData and PEXHPMarkersWithData will also accept deformation data.
Extended Pipeline Context Attributes These values are part of the list returned by an inquiry of enumerated type PEXETExtPC. PEXHPPCDeformationMode PEXHPPCDeformationValueLocation Pipeline Context Attributes Deformation mode may be set in the pipeline context. The default value for deformation mode is PEXHPDeformationOff. PEXHPChangePipelineContext is used to modify the extended pipeline context. See Chapter 6 for details on changing the HP-only attributes in the pipeline context.
Text and Fonts The fonts supported by HP PEXlib are accessed using the X Logical Font Description (XLFD) conventions. PEX stroke fonts can be regarded as in nitely scalable and rotatable, although, unlike scalable bitmap fonts, no process of font generation occurs when a font is opened. The values shown in the following tables are supported for XLFD name elds to access HP fonts that are returned by PEXListFonts and PEXListFontswithInfo and are accepted by PEXLoadFont. Table 6-19.
Font Naming and Files The default font used by PEX is a monospaced, stroke, hproman8 font (i.e., nonproportional, hproman8 glyph layout, one byte per character). This applies to both DHA applications and to the PEX server. Unlike other PEX fonts that you can inquire for font information, additional font information is not available for the default font. The pattern of the FAMILY_NAME eld starting with PEX is an HP convention for stroke fonts, it is not yet an interoperability convention.
X11R6 supports the X font server. However, the font server supports only X fonts, not PEX fonts. Another le, hextensions i10 /fp.PEX, contains a list of directories to be added to the X font path during server initialization; it should always contain at least one of those directories. Since HP CDE saves and restores the X font path across multiple sessions, HP CDE users will need to explicitly modify the X font path to access fonts other than the default.
List of Fonts Supported by Hewlett-Packard The speci c fonts supported by Hewlett-Packard, including both the XLFD and le names are: h i Table 6-21. fonts /usascii/stroke fonts Font File Name Supported XLFD Names usascii.1.pht -hp-PEX stick-medium-r-normal-normal-0-0-0-0-m-0-hp-roman8 usascii.2.pht -hp-PEX stick-medium-r-normal-normal-0-0-0-0-p-0-hp-roman8 usascii.-2.pht -hp-PEX simplex sans serif-medium-r-normal-normal-0-0-0-0-p-0-hp-roman8 usascii.-4.
h i Table 6-23. fonts /hp_japanese/stroke fonts Font File Name'' Supported XLFD Names jisasc.1.pht -hp-PEX stick-medium-r-normal-normal-0-0-0-0-m-0-hp-japaneseeuc jisasc.2.pht -hp-PEX stick-medium-r-normal-normal-0-0-0-0-p-0-hp-japaneseeuc jisasc.-2.pht -hp-PEX simplex sans serif-medium-r-normal-normal-0-0-0-0-p-0hp-japaneseeuc jisasc.-4.pht -hp-PEX simplex sans serif-bold-r-normal-normal-0-0-0-0-p-0hp-japaneseeuc jisasc.-6.
Marker and Cell Array Hewlett-Packard adds the following extension marker types: Table 6-24. Marker Type Additions Extension/Size Type/value PEXHPMarkerTriangle 0x8700 PEXHPMarkerSquare 0x8701 PEXHPMarkerDiamond 0x8702 PEXHPMarkerCrossSquare 0x8703 The HP PEXlib implementation meets the PEX \cell array" requirements by simulating the cell array: drawing its outline with polylines.
Animation Animation, or imparting the appearance of motion to objects, is accomplished with any of several methods. Each method o ers speci c advantages that you'll need to consider when selecting the most appropriate method for the circumstances. HP PEXlib supports rendering to X multi-bu er (MBX) as an e cient and portable method for creating animated images. However, the option to resort to double-bu ering with a pixmap, when MBX and E&S escapes are not available, is not supported.
Background Information In the 5.1v2 release, HP PEXlib supported the Multi-bu ering Extension (MBX) to accomplish double-bu ering. In other words, MBX bu ers were accepted as valid targets for the Renderer, and could be used in any inquiry or procedure call that required an example drawable. The application program would need to make MBX calls directly (Xmbuf( . . . )) to create and swap bu ers, but could pass the ID of an MBX bu er to the Renderer to cause drawing to that bu er.
Summary of DBE Client Entrypoints Here is a brief summary of the DBE client side entrypoints. To use these, the application program must include header le X11/extensions/Xdbe.h. For more detail, please see the reference pages in the appropriate X library manuals. Table 6-25. DBE Entry Points Description Entry Point XdbeQueryExtension Veri es that an X server supports the extension, and, if so, what version it supports (currently the only known version is 1.0).
Table 6-25. DBE Entry Points (continued) Description Entry Point XdbeBeginIdiom Speci es the beginning of a mixed sequence of calls, typically to accomplish swapping and clearing, that may or may not be optimized. In this release, the HP implementation does not optimize any sequences. XdbeEndIdiom Speci es the end of a sequence of calls. XdbeGetBackBufferAttributes Returns the ID of the window to which a back-bu er name is assigned.
Colormap/Visual utilities In this release, no changes have been made to either the HP-originated utilities (in /usr/lib/PEX5/utilities) or to the CGE utilities (in . . . /cge_utilities) to make use of DBE. Applications that wish to use DBE can select a visual that can double-bu er using the utilities as provided, and then use XdbeGetVisualInfo to verify that DBE is supported on the visual.
The Multi-buffering Extension (MBX) MBX works as described in PEXlib Programming Manual (section 14.2), rendering to speci c and separate image bu ers. Bu er IDs can be used in any PEXlib call that requires a drawable ID. It is recommended that you use the function XmbufQueryExtension rst, in order to determine whether the MBX extension is supported. Additionally, PEXMatchRenderingTargets reports PEXBufferDrawable targets on visuals that support multi-bu ering.
Using either escape, data parameters are as shown in the table below: Table 6-26. Double-Buffering Escape and -Escape With Reply Parameters Value Description display A pointer to a display structure returned by a successful XOpenDisplay call. escape_id The escape identi er. length The length, in bytes, of data for the escape request.
Table 6-27.
Evans & Sutherland Escape Requests By specifying the Evans & Sutherland escape requests the following de ned functionality is accessed. ES_ESCAPE_DBLBUFFER |This request sets up the speci ed drawable to be double bu ered. Drawing commands directed at this drawable are written into the undisplayed bu er when the bufferMode is ES_RENDERER_DBLBUFFER. A back (undisplayed) bu er is allocated when this escape is received with bufferMode set to ES_RENDERER_DBLBUFFER.
ES_ESCAPE_SWAPBUFFERCONTENT|This escape (the only one that is a PEXEscapeWithReply) returns the same value for a given drawable at all times. It is unnecessary to issue this escape after every swap because the state of the previously-displayed bu er remains consistent for the drawable. The possible values of the content are: ES_DB_SWAP_CONTENT_UNDEFINED means that the content of the previouslydisplayed bu er is unde ned. This is the HP value.
HP Escape Request The HP escape, HP_ESCAPE_DFRONT, is a companion escape to the Evans & Sutherland double-bu ering escapes described above. It allows you to set the Renderer drawing destination to either the front (visible) bu er or the back (hidden) bu er.
Inquiring Supported Escapes You can use the enumerated type descriptors to inquire which double-bu ering escapes are supported. These are also de ned in the implementation-dependent header le, PEXHPlib.h. The enumerated-type mnemonic strings and values returned from PEXGetEnumTypeInfo when inquiring with PEXEscape are: Table 6-28.
Lighting, Shading, and Depth Cueing Texture Mapping Texture mapping simulates a wide variety of surface material properties and detail for relatively modest costs in computation. Speci c control of interior colors and transparency of an area primitive results from a special \mapped" correspondence between a texture image and 3D surface during rendering. PEX support for texture mapping is currently under development by the PEX consortium, as noted in the PEXlib Programming Manual (16.1.9).
The following table illustrates the enumerated types and implementationdependent constants that are di erent in the 3D wireframe con guration than when PowerShade is present. Table 6-29. Enumerated Types and Implementation-Dependent Constants LUT HP PEX 5.
Renderers HP PEXlib o ers immediate dynamics for all attributes, including Lookup Tables and Nameset contents. This list describes the speci cs of immediate dynamics for hlhsr_mode, if changed while the renderer is active: Table 6-30. HLHSR Mode Transition Behaviors From# To! O Z Bu er O 6 1 Z Bu er Z Bu erID Z Bu erID Read-Only Read-Only 1 1 1 2 2 2 2 2 Z Bu er 3 Z Bu er Read-Only 3 2 Z Bu erID 3 2 2 Z Bu erID Read-Only 3 2 2 2 2 1.
Lookup Tables Color Approximation The color approximation lookup table (LUT) does not support arbitrary de nitions of type PEXColorSpace. The default entry for the LUT may not represent the supported de nition of that type for drawables of a particular depth and visual class. However, the prede ned entry in a LUT that has been created for that visual and class does represent the supported de nition. Servers from other vendors may support arbitrary values.
Color When realized values are inquired from the color LUT, the values will be in the same color type used when the entry was speci ed. Visible LUT behavior is speci ed in the table \LUT Default Entries" below. These are the values that are used when there isn't a current LUT of the speci ed type bound to a renderer, or if the entry being indexed does not exist and there is not any entry at the default index of the LUT.
In the case of ColorApprox LUTs, the prede ned entries depend on the drawable (visual) characteristics associated with the LUT. 6 Writing HP PEXlib Programs FINAL TRIM SIZE : 7.5 in x 9.
Table 6-32. LUT Default Entries LUT HP PEX 5.1v2 LineBundle line_type PEXLineTypeSolid polyline_interp PEXPolylineInterpNone curve_approx PEXApproxImpDep, (PEXApproxDCRelative), 1.0 line_width 1.0 line_color fPEXColorTypeIndexed, 1g MarkerBundle marker_type PEXMarkerAsterisk marker_scale 1.0 marker_color fPEXColorTypeIndexed, 1g TextBundle 6 text_font_index 1 text_precision PEXStrokePrecision char_expansion 1.0 char_spacing 0.
Table 6-32. LUT Default Entries (continued) LUT HP PEX 5.1v2 InteriorBundle interior_style PEXInteriorStyleHollow interior_style_index 1 surface_color fPEXColorTypeIndexed, 1g f1.0, 1.0, 1.0, 0.0, 0.0 (PEXColorTypeIndexed, 1)g reflection_attr reflection_model PEXReflectionNone surface_interp PEXSurfaceInterpNone bf_interior_style PEXInteriorStyleHollow bf_interior_style_index 1 bf_surface_color fPEXColorTypeIndexed, 1g f1.0, 1.0, 1.0, 0.0, 0.
Table 6-32. LUT Default Entries (continued) LUT HP PEX 5.1v2 Light light_type PEXLightAmbient direction (0, 0, 0) (not used for ambient light) point 0.0 (not used for ambient light) concentration 0.0 (not used for ambient light) spread_angle 0.0 (not used for ambient light) attenuation 0.0 (not used for ambient light) color fPEXColorTypeRGB, (1.0,1.0,1.0)g DepthCue 6 mode PEXOff front_plane 1.0 back_plane 0.0 front_scaling 1.0 back_scaling 0.
Namesets, Filters, and Searching Hewlett-Packard makes no implementation-dependent additions to these functions of PEXlib. Picking HP PEX supports the PEXPickLast method for PickOne traversals and the PEXPickAllAll method for PEXPickAll traversals. Neither of these methods uses the current setting of HLHSR. Echo and Highlighting Filter The actual visual appearance of echo and highlight modes is an implementationdependent choice that is not prescribed by the PEX and PEXlib speci cations.
Highlight Mode Attributes All primitive color attributes are set to the highlight color. The default highlight color is white, but can be changed before the client is started by setting the HPPEX_DHA_HIGHLIGHT_COLOR environment variable or by calling PEXHPOCCSetHighlightColor(). Line color interpolation is disabled Implications of The Exclusive Or Drawing Mode HP PEXlib implements echo mode using \exclusive or" drawing mode for rapid display and erasure of echo images.
A Final Word About Writing Efficient Programs . . . The discussion in Chapter 3 described how selection of the proper protocol method for the circumstances could improve performance (whether DHA, PEX, or X). In this section, the application developer can also improve performance by considering these general rules: Performance of HP PEXlib is improved if, in a series of OC commands, multiple OC targets are not alternated, or intermixed.
Using fast macros for an incremental gain in performance has some programming drawbacks. These are: You cannot take the address of a PEXlib entrypoint that is implemented as a macro. If the application had its own list that stored the address of PEXlib procedures, it would not compile while using fast macros. You cannot do this: #define RENDER display, resource_id, PEXOCRender PEXFillArea(RENDER, ...); 6 6-86 Writing HP PEXlib Programs FINAL TRIM SIZE : 7.5 in x 9.
HP PEX 5.1v3|Selected 5.2 PEXlib 7 Functionality Overview of HP PEX5.1v3 This chapter is intended to give an overall view of what is new or di erent about HP-PEX in the 5.1v3 release. There are both new features and entrypoints, and changes in support for existing features. Note that a newer release of HP-PEX is now available. For information on HPPEX 5.1v4, see Chapter 8. Background Information Previous releases of HP-PEX have been PEX 5.1 based. The initial release (HPPEX 5.
value in many PEXlib applications. In some cases, minor di erences between the HP implementation and the nal PEX 5.2 standard may occur, but none should require more than very minor adjustments to make your application 5.2 conformant. It is important to note that 5.1v3 is not a complete PEX 5.2 implementation; instead, as the release name implies, it is PEX 5.1, plus CGE PEX 1.0 extensions, plus certain selected items from the PEX 5.2 draft standard. Some of these 5.
Programming Interfaces for Generating Output Commands PEXlib Explicit Interface PEXlib o ers two major argument interfaces for the output command functions: the explicit interface and the output command context, or \OC Context" (OCC) interface. The explicit interface is the interface de ned for PEXlib 5.1 and is included in the PEXlib 5.2 speci cation for backwards compatibility, so PEXlib 5.1 programs compile with PEXlib 5.2 libraries.
PEXlib Output Command Context (OCC) Interface The output command context interface (introduced with PEXlib 5.2) requires that the rst argument always be the OC context, replacing the three arguments listed above. The OC context is an opaque structure that contains many of the arguments that are commonly found in the output command functions. Your application uses a set of special OCC manipulation functions to modify the elds in the opaque OC context.
Output Command Context (OC Context or OCC) The OC Context maintains the state of some common PEXlib arguments across PEXlib function calls. The OC context enables you to set the desired values of these arguments and then reuse them by specifying just the OC Context in several subsequent function calls. This eliminates the need to re-specify these same arguments in every function call, reducing redundancy and improving performance in some environments.
Data Structures The primary data structure used with the OC Context is the PEXOCCValues data structure which you use to set the value elds via the bitmask/value mechanism. It is important to realize that you do not alter the OC Context itself. You instead specify your desired changes in the PEXOCCValues data structure and use OCC functions to alter the OC Context with this data structure as input.
typedef struct { int facet_stride; int vertex_stride; int facet_color_offset; int facet_normal_offset; int facet_fp_data_offset; int vertex_coord_offset; int vertex_color_offset; int vertex_normal_offset; int vertex_edge_offset; int vertex_radius_offset; int vertex_axes_offset; int vertex_angle_offset; int line_vertex_fp_data_offset; int marker_vertex_fp_data_offset; int surface_vertex_fp_data_offset; } PEXOCCStrideData; /* all members 0 */ typedef struct { int facet_color_size; int facet_normal_size; int
The OCC itself is de ned as: typedef struct _PEXOCC *PEXOCC; { XExtData *ext_data; /* PEXlib private data */ } #endif *PEXOCC; /* hook for extension */ You cannot access any members within the OCC directly. You must simply pass the OCC to functions that modify or use the contents of the context structure. Sample Usage of the OCC To invoke the OC functions that use the OC Context, your application must rst create an OC Context with the PEXCreateOCC function.
Here is a coded example of how to use the OC Context. The last two statements illustrate the di erence between an OCC function and a non-OCC function: PEXOCCValues unsigned int PEXOCC ocvalues; mask; myocc; ocvalues.display = my_display; PEXSetOCCValueMask(&mask, PEXOCCMDisplay); ocvalues.renderer = my_renderer; PEXSetOCCValueMask(&mask, PEXOCCMRenderer); ocvalues.color_type = PEXColorTypeRGB; PEXSetOCCValueMask(&mask, PEXOCCMColorType); ocvalues.
Facet/Vertex Data Formats There are three ways to provide facet and vertex data to PEXlib: Packed Data Format (PEXlib 5.1 method) Unlike the stride and unpacked formats, you can use the packed data format with either OCC primitive functions or with non-OCC primitive functions. The use of the packed data format with non-OCC functions, as with PEXlib 5.
which allows you to pass any type in this parameter. This is important for the stride interface described in the next section. However, for both facet and vertex data, you are responsible for making sure that the data you are passing accurately re ects the attributes that you set in the facet or vertex attribute elds.
is on and the PEXGAFloatData ag is on. You set the color_type eld in the OCC to PEXColorTypeRGB and the number of oats in the OCC (surface_vertex_fp_data_count) to three.
Here is an illustration of the stride model, using vertex data: Figure 7-1. Stride model, with vertex data In this example, you supply a pointer to the beginning of the structured array in the function call. PEXOCCTriangleStrip(context, NULL, 20, vertex_data_pointer); To use the PEXDataStride format, you need to set some additional members in the OC Context to inform PEXlib of the details of your data's format. The following steps use the \bitmask/value" method of initializing the OC Context.
Fill in the appropriate members of a PEXOCCValues data structure: Assign all the members of the PEXOCCStrideData data structure that are applicable to your data. You only need to set the members for the vertex or facet data that you are actually using. The PEXOCCStrideData structure is a part of the data_model_specs union, so you should use the stride union member to access this structure. Assign the value PEXDataStride to the data_model member of the PEXOCCValues structure.
For each ll-area-set contour or polyline in the set, you allocate one of these structures and ll it in with the number of points in that contour or line and a pointer to the rst vertex in the list. Note that the type of the vertices pointer is PEXPointer, so you set this pointer to point to a structured array, just as in the non-nested case. The list of these PEXListOfVertexData structures must be contiguous and you pass the address of the rst one in the vertex data argument of the primitive function call.
Unpacked Data Format You use this data format when your data is arranged in lists or arrays of points, colors, normals, etc. Each of these lists can reside anywhere in memory, since you supply a pointer to the start of each list. You also must specify the size of each element in the list by using the PEXOCCUnpackedData member of the data_model_specs union. 7 Figure 7-3. Unpacked Data Model 7-16 HP PEX 5.1v3|Selected 5.2 PEXlib Functionality FINAL TRIM SIZE : 7.5 in x 9.
Using the PEXDataUnpacked format is similar to using the PEXDataStride format, except: Set the data_model member to the value of PEXDataUnpacked. Set the appropriate members of the PEXOCCUnpackedData member of the data_model_specs union with the values that re ect your data's organization. You only need to set the members for the vertex or facet data components that you are actually using.
Some primitives, such as ll area set and polylines (polyline set) are de ned by a nested list of vertices.
Errors and Output Command Errors The PEX output commands are designed so that the PEX implementation can often continue to process an OC with an error in it by using defaults or fall-back values. However, in some cases, it is not practical to de ne a reasonable fall-back value and so the PEX implementation stops processing OCs and generates an error, usually a BadPEXOutputCommand error. Many BadPEXOutputCommand errors are very speci c to the output command and are listed with the function.
Simplified OCC functions for Primitive OCs Beginning with PEXlib release 5.1v3, the output command context (OCC) makes it possible to generate primitives that use a wide variety of attributes with a smaller number of functions. The following table describes what OCC functions to use to generate the corresponding primitive in terms of the non-OCC function form. Primitives added after PEXlib release 5.1v3 will, in general, be accessible only via the OCC function format. In the 5.
Table 7-1.
Table 7-1. Relationship Between OCC and Non-OCC Primitive Functions (continued) Non-OCC Form OCC Form PEXOCCPolyline PEXPolyline PEXOCCPolyline PEXPolyline2D PEXOCCPolylines PEXPolylineSetWithData PEXOCCQuadrilateralMesh PEXQuadrilateralMesh PEXOCCText PEXText PEXOCCText2D PEXText2D PEXOCCTriangleStrip PEXTriangleStrip Generating HP PEX 5.1 Output Commands 7 PEX 5.
Examples Below is an example illustrating two ways to set up for rendering a PEXOCCTriangleStrip using the PEXDataStride data model with an array of application de ned vertex data structures. Note that the OCC setup is required only one time provided that nothing in the data format changes. The OCC can then be re-used on all subsequent triangle strip primitives. /* Following is a sample definition of an application's data structure containing vertices, colors, normals, and other application data.
/* Method #1: * Set the OCCValues structure for OCC context creation. * Note that for convenience in this example, we utilize * the default values for: * facet_attributes (PEXGANone), * req_type (PEXOCRender), and * color_type (PEXColorTypeRGB). */ occ_values.display = dpy; PEXSetOCCValueMask(&occ_mask, PEXOCCMDisplay); occ_values.renderer = rdr; PEXSetOCCValueMask(&occ_mask, PEXOCCMRenderer); occ_values.
/* Malloc space for NUM_TRI_POINTS application vertices */ app_vertices=(app_vertex_def*)malloc((NUM_TRI_POINTS)*sizeof(app_vertex_def)); /* Fill in vertex structures */ for(i = 0; i << NUM_TRI_POINTS; i++) { app_vertices[i].point = vertex coordinate data; app_vertices[i].color = vertex color data; app_vertices[i].normal = vertex normal data; . . .
Below is the same example, this time illustrating the PEXDataUnpacked formatting method to be used in rendering. /* Following are the application vertex, color, and normal arrays. */ PEXVector *normals; PEXColorRGB *colors; PEXCoord *vertices; { Display *dpy; PEXRenderer rdr; PEXOCC tri_context; PEXOCCValues occ_values; unsigned long occ_mask = 0; /* Note that the OCC Convenience functions are used to set up the OCC Context * as below.
/* Fill in the pointers to * vertices structure. */ unpacked_vertices.coords unpacked_vertices.colors unpacked_vertices.
Structure Permissions Introduction Structure permissions control access to a structure so performance optimization can take place. The application developer is signaling PEXlib that the given structure or element is static and should now be altered to improve performance. The two levels of permission are write-only and locked. The structure can be made write-only to allow only additions and replacements or it can be locked so no editing is allowed.
Using Permission Features Here is an overall summary of the edit operations that are allowed on structures with the various permissions: Table 7-2.
is locked, it cannot be unlocked, so the application must have a way to regenerate the data in a ReadWrite or WriteOnly structure. An application that supports an alternating edit/view cycle of user interaction might operate on an editable hierarchy during the edit session, and then create a separate locked structure hierarchy while viewing or animating. However, the amount of extra data space required for the extra copy must be traded o against the performance improvement.
All these strategies come together when a complex model is built and modi ed by picking pieces to modify. The following outline shows how this might be done by keeping a ReadWrite copy of the structure. PEXCreateStructure A PEXCreateStructure ALocked . . .
PEXGetStructureInfo The structure that is returned has an added eld for the permission values.
Z-Buffer Block Operations Introduction HP PEXlib 5.1v3 o ers various ways to read blocks from the Z-bu er or write blocks into the Z-bu er. There are two main reasons why you might want to read/write the Z-bu er. One is so you can implement your own picking that considers the Z-bu er state. The second reason is to save/restore either the entire window or only a section of the window. When saving/restoring 3D graphics, the Z-bu er needs to be saved/restored along with the frame bu er.
PEXEscapeWithReply: PEXHPEscapeOpcodeGetZBuffer This section describes the PEXHPEscapeOpcodeGetZBuffer opcode. PEXHPEscapeOpcodeGetZBuffer Syntax The syntax for this PEXEscapeWithReply is: char *PEXEscapeWithReply( Display *display, unsigned long escape_id, int length, char *escape_data, unsigned long *reply_length_return) PEXHPEscapeOpcodeGetZBuffer Parameters A pointer to a display structure returned by a successful XOpenDisplay call.
PEXHPEscapeOpcodeGetZBuffer Description PEXHPEscapeOpcodeGetZBuffer allows the user to read a block from the Z-bu er. This call is identical to PEXGetZBuffer except that the Z-bu er values are the raw hardware values, not normalized. The parameters that go into the escape_data structure are the same ones and in the same order as the parameters that are passed into PEXGetZBuffer.
PEXHPEscapeOpcodeGetZBuffer Example Here is one way to use PEXHPEscapeOpcodeGetZBuffer : int escape_data[20]; int *zbuffer_data; PEXHPEscapeGetZBuffer *reply_data; /* Set up to read a 2x3 Z-buffer block at (10,20) */ escape_data[0] = renderer; escape_data[1] = 10; escape_data[2] = 20; escape_data[3] = 2; escape_data[4] = 3; /* Read raw Z-buffer values from the Z-buffer.
PEXEscape: PEXHPEscapeOpcodePutZBuffer This section describes the PEXHPEscapeOpcodePutZBuffer opcode. PEXHPEscapeOpcodePutZBuffer Syntax The syntax for this PEXEscape is: void PEXEscape( Display unsigned long int char *display, escape_id, length, *escape_data ) PEXHPEscapeOpcodePutZBuffer Parameters display escape_id length escape_data A pointer to a display structure returned by a successful XOpenDisplay call.
PEXHPEscapeOpcodePutZBuffer Example Here is one way to use PEXHPEscapeOpcodePutZBuffer : int escape_data[36]; /* Set up to write a 2x2 Z-buffer block at (10,20). * We will write the value 0x7FFFF000 into the Z-buffer */ escape_data[0] = renderer; escape_data[1] = 10; escape_data[2] = 20; escape_data[3] = 2; escape_data[4] = 2; escape_data[5] = 0x7FFFF000; escape_data[6] = 0x7FFFF000; escape_data[7] = 0x7FFFF000; escape_data[8] = 0x7FFFF000; /*Write raw Z-buffer values into the Z-buffer.
PEXHPEscapeOpcodeEVEInformation Parameters display escape_id A pointer to a display structure returned by a successful XOpenDisplay call. This is the opcode: PEXHPEscapeOpcodeEVEInformation The length, in bytes, of the data for the escape request. This is an array of ints with the following elds: escape_data[0] Renderer (the Renderer ID) reply_length_return Length of the reply data in bytes.
PEXHPEscapeOpcodeEVEInformation Example Here is one way to use PEXHPEscapeOpcodeEVEInformation: int escape_data[1]; PEXHPEscapeEVEInformation *EVEInfo; /* Grab Z-buffer statistics.
Plane Mask and Drawing Function HP-PEXlib 5.1v3 supports the PEXlib 5.2 attribute output commands PEXOCCSetPlaneMask and PEXOCCSetDrawingFunction. The online reference pages provide details on the interfaces to these entrypoints. Both of these attributes are applied in the very last step in PEX rendering, when a source pixel value (derived from the rendering pipeline RGB value using the current Color Approximation table entry) is combined with a destination pixel value (already in the frame bu er).
FINAL TRIM SIZE : 7.5 in x 9.
HP PEX 5.1v4|More Selected 5.2 PEXlib 8 Functionality and HP Extensions Overview of HP PEX5.1v4 This chapter is intended to give an overall view of what is new or di erent about HP-PEX in this release. There are both new features and entrypoints, and changes in support for existing features. Background Information HP PEX 5.1v4 is a superset of HP PEX 5.1v3, which is described in the chapter called \HP PEX 5.1v3|Selected 5.2 PEXlib Functionality". HP PEX 5.
Global Description of the HP-PEX 5.1v4 Release Additional Functionality HP-PEX Release 5.1v4 includes support for the following new functionality and entry points. Further information is contained later in this chapter.
New Functionality Descriptions Wideline Control A new wideline control renderer attribute (PEXHPRAWideLineControl) is settable via PEXHPChangeRenderer. This HP extended renderer attribute controls the method used to render wide lines. The attribute value PEXHPWideLineControlStroked instructs the renderer to draw wide lines as a series of multiple strokes. The default attribute value PEXHPWideLineControlImpDep allows the renderer to choose any method to render the wide lines.
method of using the hardware, it is necessary to restrict the window con guration in this way. The enabled eld should be set to True to enable stereo display mode for the window, and False to disable it. The direct-call interface, PEXHPSetStereoMode, is available for applications that do not have portability issues in using such platform-dependent entrypoints. Please see the reference page for PEXHPSetStereoMode for further details.
Projection Coodinate) space, while leaving the Renderer's NPC-to-viewport mapping unchanged. If the PEX utility PEXViewMappingMatrix is used to compute the view mapping matrix, specify the view \window" (in view reference coordinates, or VRCs) normally, but specify the \viewport" (in NPCs) to be either the upper or lower half of the NPC space. 5. Most stereo viewing uses animation as a key feature to help the user get visual cues from the image.
Figure 8-1. Triangle Primitive Examples For the triangle strip, each triangle is formed by a vertex and the two vertices that precede it in the vertex list. For the triangle fan, each triangle is formed by a vertex, the vertex that precedes it in the vertex list, and the rst vertex in the list. For the independent triangles, each three consecutive vertices in the vertex list de ne an independent triangle.
Indexed Primitives In addition to the SOFAS primitive, HP PEXlib now supports additional primitives that use a connectivity list to index into a list of vertices. Markers, polylines, triangle fans, triangle strips, and independent triangles now support this method of specifying vectors. With the addition of these new indexed primitives, most primitives using vertex lists have both indexed and non-indexed forms.
For more information on user-de ned linetypes and marker-glyphs, see the following on-line reference pages: PEXHPOCCSetUserLineType PEXHPOCCSetUserMarkerGlyph Highlight Color Prior to this release, you had to select the highlight color prior to running the PEXlib application by setting an environment variable, or letting it remain the default color of white. PEXlib now supplies a function to allow you to change the highlight color at any point during program execution.
is used to generate Z-bu er values that are o set from what the default Zbu er values would be. This behavior allows an application to use an algorithm that may yield signi cantly better performance in rendering lled areas with edging (on those graphics devices that support the attribute) over the default PEX method for rendering edged areas. Details of the algorithm are explained below. Other uses to reduce rendering artifacts are also possible.
The data values that are part of the attribute are set in the polygon_offset substructure of the PEXHPRendererAttributes structure. This substructure is of type PEXHPPolygonOffsetValues and contains three elds that are used as follows: enabled Enable ag: set to True to enable polygon o set; set to False to disable application of the o set. offset Bias value. slope_factor Factor value.
Such a \grouping" of operations must be done at the application level. Obviously, the edging is done via line primitives in this algorithm, so line attributes must be set to the desired edge values. The typical problem with this better-performing method of rendering is that when the edge vectors are rendered, a lot of stitching is visible because of the values already stored in the Z-bu er by the ll rendering. O setting the ll rendering in the Z-bu er can eliminate this stitching.
Display Window *display; window; PEXRenderer short PEXImpDepConstant renderer_id; id_name; *id_const_info; PEXHPRendererAttributes hp_attrs; unsigned long hp_ra_mask; . . . display = XOpenDisplay(...); /* Initialize an X connection. */ PEXInitialize (display, ...); /* Initialize PEX on the connection. */ . . . /* Create a window or buffer drawable in a particular target Visual, to be used for PEX rendering. */ window = ... . . . /* Create a Renderer for this target.
/* Set the interior style to solid, without edging. */ PEXSetInteriorStyle (display, renderer_id, PEXOCRender, PEXInteriorStyleSolid); PEXSetSurfaceEdgeFlag (display, renderer_id, PEXOCRender, PEXOff); /* Enable polygon offset. */ hp_attrs.polygon_offset.enabled = True; hp_attrs.polygon_offset.offset = 1.0; hp_attrs.polygon_offset.slope_factor = 1.
FINAL TRIM SIZE : 7.5 in x 9.
9 9 Overview of CGE PEX Texture Mapping This overview shows the parameters and data structures for PEXlib texture mapping calls. Use this section as a resource while developing texture-mapping programs; it explains texture-mapping parameters in detail. Note that in the \Parameters" sections, only those parameters directly related to texture mapping are described (for example, the Display argument is not explained in any detail).
9 Also, in HP PEX releases 5.1v3 and later releases;, PEXSetInteriorStyle is de ned to be PEXExtInteriorStyleTexture and the parameterization method speci ed is not PEXExtTMParamExplicit, then 5.1 Output Commands will be texturable for the Output Commands that correspond to the 5.2 Output Commands. Table 9-1. Output Commands Texturable 5.1 Output Commands 5.
9 Step 1: Setup Setting up for texture mapping involves ensuring that texture mapping is supported on the current implementation of PEXlib, and inquiring implementationdependent constants that a ect texture mapping. Function: PEXGetEnumTypeInfo (optional). Get enumerated type information to ensure that texture mapping is supported by this implementation of PEXlib. Returns non-zero if successful and zero if an error occurred. Function: PEXFreeEnumInfo (optional).
9 These are the extended PEX enumerated types.
9 The following are the extended enumerated types that may be returned.
9 PEXExtETLUT PEXExtLUTTMBinding PEXExtLUTTMCoordSource PEXExtLUTTMComposition PEXExtLUTTMSampling PEXExtETID PEXExtIDMaxTextureMaps PEXExtIDMaxFastTMSize PEXExtIDPowerOfTwoTMSizesRequired PEXExtIDSquareTMRequired PEXExtETTMRenderingOrder PEXExtTMRenderingOrderPreSpecular PEXExtTMRenderingOrderPostSpecular PEXExtETTMCoordSource PEXExtTMCoordSourceVertexCoord PEXExtTMCoordSourceVertexNormal PEXExtTMCoordSourceFloatData PEXExtETTMCompositeMethod PEXExtTMCompositeReplace PEXExtTMCompositeModulate PEXExtTMComp
9 PEXExtETTMClampColorSource PEXExtTMClampColorSourceAbsolute PEXExtTMClampColorSourceExplicit PEXExtETTMDomain PEXExtTMDomainColor1D PEXExtTMDomainColor2D PEXExtTMDomainColor3D PEXExtETTexelType PEXExtTexelLuminanceInt8 PEXExtTexelLuminanceInt16 PEXExtTexelLuminanceAlphaFloat PEXExtTexelLuminanceAlphaInt8 PEXExtTexelLuminanceAlphaInt16 PEXExtTexelRGBFloat PEXExtTexelRGBInt8 PEXExtTexelRGBInt16 PEXExtTexelRGBAlphaFloat PEXExtTexelRGBAlphaInt8 PEXExtTexelRGBAlphaInt16 PEXExtTexelLuminanceFloat PEXExtETTMTyp
9 PEXExtETPrimitiveAAMode PEXExtPrimAANone PEXExtPrimAAPoint PEXExtPrimAAVector PEXExtPrimAAPointVector PEXExtPrimAAPolygon PEXExtPrimAAPointPolygon PEXExtPrimAAVectorPolygon PEXExtPrimAAPointVectorPolygon PEXExtETPrimitiveAABlendOp PEXExtPrimAABlendOpImpDep PEXExtPrimAABlendOpSimpleAlpha PEXExtETLineCapStyle PEXExtLineCapStyleButt PEXExtLineCapStyleRound PEXExtLineCapStyleProjecting PEXExtETLineJoinStyle PEXExtLineJoinStyleImpDep PEXExtLineJoinStyleRound PEXExtLineJoinStyleMiter PEXExtLineJoinStyleBevel
9 Additional Types of PEXETLineType PEXExtLineTypeCenter PEXExtLineTypePhantom Additional Types of PEXETHatchStyle PEXExtHatchStyle45Degrees PEXExtHatchStyle135Degrees Additional Types of PEXETInteriorStyle PEXExtInteriorStyleTexture PEXGetImpDepConstants : Parameters names[0] = PEXExtIDMaxTextureMaps; Maximum number of texture maps that can be applied to a single primitive. For HP PEX, PEXExtIDMaxTextureMaps is device-dependent and should be inquired.
9 True if the size of all dimensions of all texel arrays de ning a texture map must be powers of two. For HP PEX, PEXExtIDPowerOfTwoTMSizesRequired = True. Note, however, that the PEXExtCreateFilteredTM and PEXExtCreateFilteredTMFromWindow utilities can be used to upsample texel arrays to a power of two. names[3] = PEXExtIDSquareTMRequired; True if each level of a texture map must have equally sized dimensions. For HP PEX, PEXExtIDSquareTMRequired is False.
9 Step 2: Texture Preparation Preparing a texture for use by PEXlib involves pre- ltering the texture to create a MIP map, importing the map into PEXlib and combining the map with parameterization and rendering information to create a texture map description. Function: PEXExtCreateFilteredTM (optional). Creates a ltered texture map from base_map and stores the results in texel_array. After this call, texel_array should be passed to PEXExtCreateTM to import it into PEXlib.
9 PEXExtCreateFilteredTM: Parameters int domain; Speci es the dimension of the texture map and how the texture map will a ect a primitive. Only the primitive color can be a ected. Supported values are: PEXExtTMDomainColor1D: Texture mapping a ects the color and alpha values using a 1D texture map. PEXExtTMDomainColor2D: Texture mapping a ects the color and alpha values using a 2D texture map.
9 unsigned short int num_levels; /* Number of MIP map levels to create. If num_levels is set to zero, the optimum number of levels will be generated to create a full (MIP) map and num_levels will be updated to reflect the number of levels created. */ } color; } data; } domain_data; /*--------------------------------------------------------------------------*/ unsigned int power_of_two_tm_required; /* Indicates whether the dimensions of texture maps must be a power of two.
9 /*--------------------------------------------------------------------------*/ struct PEXExtTexelDimension { unsigned short int t0; /* Texture map width */ unsigned short int t1; /* Texture map height */ unsigned short int t2; /* Texture map depth: should be 0 */ }; /*--------------------------------------------------------------------------*/ PEXExtTexelArray **texel_array /* Texture map array allocated and filled by this utility.
9 PEXExtCreateFilteredTMFromWindow : Parameters See also descriptions of domain, domain_data, power_of_two_tm_required, square_tm_required , and texel_array under \PEXExtCreateFilteredTM: Parameters". unsigned int luminance_channel_selector; /* Luminance channel source selector. Unused by HP PEX */ /*--------------------------------------------------------------------------*/ XID base_color_map; /* X window identifier of an unobscured window to use as the source texture map.
9 PEXExtCreateTM: Parameters Also see descriptions of domain, domain_data, and texel_arrays under PEXExtCreate FilteredTMParms. PEXExtTexelArray *texel_arrays; /* Texture map data. Number of arrays depends on the number of levels and the texture map type (as defined by domain and domain_data). Texel arrays are ordered sequentially by logical levels, the base level being first in the list. Every subsequent map is ordered by its level from the largest dimension down to the smallest dimension.
9 PEXExtCreateTMDescription: Parameters Note that for best results when using PEXExtTMParamReflectSphereWC, the boundary conditions should be set to PEXExtTMBoundaryCondWrap to achieve the most natural results. The boundary conditions, t0_boundary and t1_boundary are set in the Sampling LUT. The wrap boundary condition leads to better hiding of the texture seams in the case of World Coordinate re ection mapping.
9 defined in view reference coordinates (VRC). At the time of activation (PEXExtSetActiveTextures), equations p0 and p1 are inversely transformed from VRC space back into Model Coordinate (MC) space. Once there, they define a projection function such that objects appear to "swim" through a solid field of texture coordinates. The result is texture mapping.
9 Step 3: Geometry Preparation Geometry preparation is concerned with generating the texture coordinates for primitives that are to be texture-mapped. Note that an application has three choices for computing vertex coordinates: Set hparameterization i equal to PEXExtTMParamReflectSphereVRC or PEXExtTMParamReflectSphereWC and pass to PEXExtCreateTMDescription and allow PEXlib to calculate the texture coordinates. This produces viewdependent environment mapping.
9 PEXExtTMCoordFillAreaSetWithData: Parameters struct PEXExtTMCoordData { /* Parameterization data for this primitive */ PEXEnumTypeIndex projection; /* Projection method (or projection object). Supported values: PEXExtTMProjectionSphereWC: The texture coordinates are derived using an infinite sphere as a projection object with (0,0,0) as its origin and the +Y axis as the axis of revolution. The texture seams lie on the positive and negative X axes.
9 PEXExtEnumTypeIndex unsigned short int PEXMatrix mc_transform; coord_source; /* Specifies source coordinates for computing the projections. Supported values are: PEXExtTMCoordSourceVertexCoord: Use the vertex coordinate to compute the direction vector for the projection. PEXExtTMCoordSourceVertexNormal: Use the vertex normal to compute the direction vector for the projection. The vertex normal will be computed if it does not already exist.
9 /*--------------------------------------------------------------------------*/ unsigned int vertex_fp_data_size /* Number of floating point data values defined with the vertex. To accommodate texture coordinates, this number should be at least two and may be higher if additional floating point data is included with the primitive's vertex data.
9 } PEXVertexCIEEdge PEXVertexRGB8Edge PEXVertexRGB16Edge PEXVertexNormalEdge PEXVertexIndexedNormalEdge PEXVertexRGBNormalEdge PEXVertexHSVNormalEdge PEXVertexHLSNormalEdge PEXVertexCIENormalEdge PEXVertexRGB8NormalEdge PEXVertexRGB16NormalEdge PEXPointer *cie_edge; *rgb8_edge; *rgb16_edge; *normal_edge; *index_normal_edge; *rgb_normal_edge; *hsv_normal_edge; *hls_normal_edge; *cie_normal_edge; *rgb8_normal_edge; *rgb16_normal_edge; with_fp_data; PEXExtTMCoordSetOfFillAreaSets: Parameters See also \P
9 Step 4: Set Up the Look-Up Tables (LUTs) Four LUTs|Binding, Coordinate Source, Composition, and Sampling|are used to control the mapping of textures onto primitives. These LUTs are created, manipulated, and inquired using the standard calls PEXCreateLookupTable, PEXGetTableInfo, PEXGetDefinedIndices, and the extended calls, PEXExtSetTableEntries, PEXExtGetTableEntry, PEXExtGetTableEntries, and PEXExtFreeTableEntries.
9 Coordinate-Source LUT htable type i = PEXExtLUTTMCoordSource struct PEXExtTMCoordSourceEntry { PEXEnumTypeIndex tm_source; unsigned short int PEXMatrix } /* tm_source and fp_data_index are used only with texture maps that are defined for explicit parameterization; that is, parameterization is set to PEXExtTMParamExplicit when PEXExtCreateTMDescription is called. For other parameterization methods, these values are ignored.
9 Composition LUT htable type i = PEXExtLUTTMComposition struct PEXExtTMCompositionEntry { PEXEnumTypeIndex method; } 9-26 unsigned short union { PEXColorSpecifier struct { unsigned long PEXColorSpecifier } blend_env; struct { unsigned long PEXColorSpecifier PEXColorSpecifier } blend_repl; PEXExtImpDepData } data; reserved; /* Specifies how the texture map is blended with a primitive's existing color and alpha data.
9 Sampling LUT htable type i = PEXExtLUTTMSampling struct PEXExtTMSamplingEntry { PEXEnumTypeIndex minification_method; /* Used when multiple texture-map texels map to a single primitive pixel. Supported values are: PEXExtTMTexelSampleSingleBase: The closest single texel selected by the texture coordinate(s) is sampled from the base texture map level (default). PEXExtTMTexelSampleLinearBase: The 2^n closest texels selected by the texture coordinate(s) are sampled from the base texture map level.
9 PEXEnumTypeIndex PEXEnumTypeIndex PEXEnumTypeIndex PEXEnumTypeIndex 9-28 texture coordinate (s) are sampled from the two closest texture map levels to the sample depth. Note that n is the dimension (1D, 2D, or 3D) of the texture map. A weighted average is taken of these 2^n texels on each of the texture map levels. The texel found at the exact sample depth by linear interpolation between these two calculated texels is used.
9 PEXEnumTypeIndex PEXColorSpecifier float float float float } map. This produces the effect of alternating the texture map with a version of the map that is "backwards", "upside down", or both (depending on the values of t0_boundary_condition and t1_boundary_condition). */ boundary_clamp_color_source; /* Determines source of color if the boundary_condition is PEXExtTMBoundaryCondClampColor. Supported values are: PEXExtTMClampColorSourceAbsolute: Texturing is discontinued.
9 Step 5: Render The rendering step actually applies textures to primitives and controls texturemapping rendering options. The individual calls included in the rendering step may be executed repeatedly in response to input from the user. Function: PEXSetInteriorStyle PEXSetBFInteriorStyle . Set front-face and back-face interior style. Function: PEXExtSetTMPerspectiveCorrection (optional). Sets the method of perspective correction for texture mapping.
9 If the Output Commands used in the Rendering phase of texture mapping are placed in a structure, and an application must access those Output Commands, the following extended calls must be used: PEXExtCountOCs PEXExtDecodeOCs PEXExtEncodeOCs PEXExtFetchElements PEXExtFetchElementsAndSend PEXExtFreeOCData PEXExtGetSizeOCs PEXSetInteriorStyle: int style; Parameters /* Interior style.
9 PEXExtSetTMResourceHints: Parameters int optimization_hint; unsigned int count; PEXTableIndex priorities; PEXExtSetActiveTextures: Parameters unsigned short int count; unsigned short int *textures; 9-32 /* Resource optimization approach to consider for all subsequently activated textures. Supported values are: PEXExtTMResourceHintNone: Use the default optimization. PEXExtTMResourceHintSpeed: Attempt to optimize performance of texture mapping.
9 PEXExtChangePipelineContext: unsigned long *value_mask; Parameters /* Indicates which attribute values are specified. PEXExtSetPCAttributeMask can be called to set up non-extended and extended portions of the value_mask. Texture-mapping pipeline context attributes are: PEXExtPCTMPerspectiveCorrection (see PEXExtSetTMPerspectiveCorrection). PEXExtPCTMResourceHints (see PEXExtSetTMResourceHints). PEXExtPCTMSampleFrequency (see PEXExtSetTMSampleFrequency).
9 PEXExtFillAreaSetWithData: unsigned int Parameters vertex_fp_data_size; /* Number of floating point values defined with each vertex. This number should be increased by two if texture coordinates are included with the data in vertex_lists and were calculated by the utility PEXExtTMCoordFillAreaSetWithData. */ unsigned int vertex_attributes; /* The flag PEXExtGAData must be included in this mask if the texture coordinates are included in the vertex_lists.
9 my_vertex_data.coords_and_normal.point.z = MY_VERTEX_Z; my_vertex_data.coords_and_normal.normal.x = MY_VERTEX_NORMAL_X; my_vertex_data.coords_and_normal.normal.y = MY_VERTEX_NORMAL_Y; my_vertex_data.coords_and_normal.normal.z = MY_VERTEX_NORMAL_Z; my_vertex_data.texture_coords[1] = MY_TEXTURE_COORDINATE_X; my_vertex_data.texture_coords[2] = MY_TEXTURE_COORDINATE_Y; /* Note that PEXExtTMCoordFillAreaSetWithData can be used to fill in my_vertex_data. */ vertex_data.
9 Step 6: Cleanup Cleanup involves releasing the memory used by texture resources when those resources are no longer needed. Function: PEXExtFreeTM (optional). Free a texture map resource. Function: PEXExtFreeTMDescription (optional). Free a texture map description resource. PEXExtFreeTM: Parameters PEXExtTextureMap texture_map; PEXExtFreeTMDescription: /* Texture resource to free; created using PEXExtCreateTM.
10 10 Texture Mapping Tutorial This tutorial describes the \big picture" of texture mapping to help you, the application developer, determine how best to integrate this technology into your applications. Listed herein are many of the considerations that must be addressed when presenting texture mapping to an end-user. Texture Mapping Tutorial FINAL TRIM SIZE : 7.5 in x 9.
10 Texture mapping has many di erent uses, including: Data Display. Texture maps can be used to display many di erent kinds of scienti c data including, but not limited to satellite, seismic, medical imaging, and geographic data. Figure 10-1. Texture Mapping to Display Data 10-2 Texture Mapping Tutorial FINAL TRIM SIZE : 7.5 in x 9.
Realism. Texture mapping greatly increases the realism of a rendering and is especially valuable for presentation and design. Imagine how uninteresting and arti cial-looking the image below would be with an unpatterned oor, unpatterned walls, a blank (or simple geometric) picture on the wall, blank windows, at replace, etc. Figure 10-2. Texture Mapping to Add Realism Data Reduction. Data size can be drastically reduced by mapping details onto geometric objects instead of modeling those details.
10 Creating and Editing Textures End-users will want to use texture maps from many di erent sources. For scienti c data display applications, the texture maps will be created from realworld data and may be in almost any for mat. One of the application developer's jobs is to support the importation of this data into the application or to document the supported formats so the end user can translate their data into these formats.
The le reader, read_texture, is provided for your convenience, particularly to use one of the example programs with a texture le of your own choosing. The le reader is not guaranteed to read all les in the supported formats; in particular, it does not support maps with an alpha channel included.
10 Sources of Textures The following products facilitate texture creation and editing. Please contact the companies directly for details and pricing. These products are listed for your information only, and except for the products from HP, do not represent an endorsement by HP. Pixel!FX Scanner support, image viewing and manipulation including resize, blend, rotate, etc. Supports TIFF, XWD, X bitmap and GIF formats. Contact: Mentalix, 1700 Alma Drive Suite 110, Plano, Texas 75075.
10 Predefined Textures There are texture map libraries on CD-ROM available from the following sources. Please contact the companies listed for pricing and more information. These products are listed for your information only, and do not represent an endorsement by HP. Pixar One Twenty Eight CD Photographic textures include bricks, fabrics, environmental, landscaping, etc. Includes 128 5122512224 bit images in TIFF format.
10 User Interface Considerations Determining how to present texture mapping to the end user of an application deserves careful consideration. When texture mapping is used to increase realism, \getting it right" relies on trial-and-error user interaction. Users will want to try di erent texture placements and rendering options before deciding which combination is best for the speci c texture and geometry.
10 Using PEXlib for Texture Mapping There are six main steps required to use PEXlib texture mapping; these steps are described in the next sections of the tutorial: \Step 1: Setup" A. Ensure texture mapping support. B. Inquire implementation dependent constants. \Step 2: Texture Preparation" A. Create a ltered map resource from the source texture map and import it into PEXlib. B. Create a texture map description resource. \Step 3: Geometry Preparation" A. Compute texture coordinates with PEXlib utilities.
10 The graphics pipeline|that sequence of steps your graphical data goes through in the process of getting from your model to the nished image on the display| is as follows: 1. Prespecular texturing; 2. Lighting and shading; 3. Postspecular texturing; 4. Depth cueing; 5. Screen door transparency applied; 6. Replacement rules are applied; 7. Final alpha blending with the frame bu er (if supported in hardware).
10 Step 2: Texture Preparation A. Create a ltered map resource from the source texture map and import it into PEXlib. Texture preparation involves creating a ltered map (a \MIP map") from your source map using PEXExtCreateFilteredTM or PEXExtCreateFilteredTMFromWindow and importing that map into PEXlib via PEXExtCreateTM. Note that after PEXExtCreateTM has been called, PEXExtFreeFilteredTM can be called to reclaim memory used for the ltered map.
10 PEXExtParamExplicit (view-independent, standard mapping) The application calculates texture coordinates or uses the client-side utilities PEXExtTMCoordFillAreaSetWithData, PEXExtTMCoordSetOfFillAreaSets, PEXExtTMCoordTriangleStrip , and/or PEXExtTMCoordQuadrilateralMesh. Visual result: The texture map is xed to the primitive, regardless of the position of the camera or animation of the primitive.
It should be noted that the visual result of this technique is subject to the currently active view orientation, local and global transforms at the time of activation. If scaling and rotation are incorporated in any of these matrices, repetition and distortion of the texture eld may result. The distinction between view-dependent and view-independent texture coordinates is an important one.
10 is placed on an object much the same way as a piece of wrapping paper is applied to a gift. Environment mapping is a form of re ection mapping where the texture map is a picture of the environment from the viewpoint of the object at the center of the environment. PEXlib re ection mapping can also be used to simulate chrome or other shiny materials. Because some shiny materials like chrome are not perfect re ectors, re ection mapping provides a relatively inexpensive way to simulate a shiny object.
10 Figure 10-3. Coordinate Systems of the Three Types of Projection Objects Finding the correspondence between a 2D map and 3D object is not as trivial as it might appear. In the case of PEXlib, mathematical projections are used to derive the correspondence, in a two-step process. Texture Mapping Tutorial FINAL TRIM SIZE : 7.5 in x 9.
10 First, the geometric model is projected onto a standard volume, or projection object, and second, the projection object is \unfolded" to a at, 2D surface that corresponds to a 2D texture map. Figure 10-4. \Unfolding" a Projection Object 10-16 Texture Mapping Tutorial FINAL TRIM SIZE : 7.5 in x 9.
These two steps are described in more detail below. A. The geometric model is conceptually placed in the center of a projection object. (PEXlib supports projection objects sphere, cylinder, and plane). For each vertex in the model, a vector is calculated that intersects the projection object. Figure 10-5. Geometric Model with Various Projection Objects Projection objects of may be rotated using the matrix passed to PEXExtCreateTMDescription or the PEXExtTMCoord* utilities.
10 cylinder. Finally, for planar projections, [0,w ] maps to [0,1] and [0,h ] maps to [0,1] where w and h are the width and height of the projection plane, respectively. Before the texture coordinates are used to access the texture map, they are rst transformed by the orientation matrix in the Coordinate Source LUT. This transformation e ectively allows the texture to be translated, rotated and scaled before it is applied to the geometry.
10 Step 3: Geometry Preparation A. Compute texture coordinates with PEXlib utilities. Recall from the \Step 2: Texture Preparation" discussion, that when parameterization is set to PEXExtParamExplicit and passed to PEXExtCreateTMDescription, the texture coordinates are expected to be computed by the client-side PEXlib utilities (or by the application), not by the PEXlib server as determined by the other values of parameterization.
10 The PEXExtTMCoord* utilities require that the following information be speci ed: projection: PEXExtTMProjectionSphereWC, PEXExtTMProjectionCylinderWC , and PEXExtTMProjectionLinearWC are supported projection objects. The primitive described in a call to one of these utilities will be conceptually projected onto the projection object (sphere, cylinder, or plane) to derive the texture coordinates. Figure 10-6.
If PEXExtTMCoordSourceVertexNormal is selected, but normals are not supplied with the primitive's vertex data, the normals will be derived by the utility. model_transform: A model coordinate transform is provided to convert from model to world coordinates, if desired. One advanced use of the model_transform, for example, is a tire modeled once but instantiated four times.
10 Step 4: Set up Texture Mapping Lookup Tables (LUTs) The texture mapping Lookup Tables control how a texture is positioned on an object and how the texture mapped object will appear once it is rendered. These LUTs are created, manipulated, and inquired using the standard calls, PEXCreateLookupTable, PEXGetTableInfo, PEXGetDefinedIndices, and the extended calls PEXExtSetTableEntries, PEXExtGetTableEntry, PEXExtGetTableEntries, and PEXExtFreeTableEntries.
C. The Replace operation overwrites the primitive's existing color with that of the texture map. Likewise, if a texture alpha is speci ed, the primitive's alpha is replaced. If alpha is not speci ed, the primitive's alpha remains unchanged. D. The Modulate operation multiplies each component (R, G, B) of the primitive's existing color with each component of the texture map color. If texture alpha is speci ed, the primitive's alpha is multiplied by the texture alpha to determine the nal alpha. E.
10 The t0_frequency_hint, t1_frequency_hint, and t2_frequency_hint, can be applied by advanced texture mapping users based on the actual data in a given texture map. If blurring in any one direction would be unacceptably high due to low spatial frequency, this hint may be set to a value between 0.0 and 1.0 for that direction. The a ect will be to bias the texture map sampling to reduce the blurring. G.
10 B. Activate texture(s). One or more textures must be activated using the call PEXExtSetActiveTextures. Backface textures can be activated by PEXExtSetBFActiveTextures. Note that the number of active textures allowed may be inquired using PEXGetImpDepConstants.
10 References Bier, Eric A. and Sloan, Kenneth R., Jr., \Two-Part Texture Mappings," IEEE Computer Graphics and Applications , Sept. 1986, The Computer Society, Los Alamitos, CA, pp. 40|53. Blinn, James F. and Newell, Martin E., \Texture and Re ection in Computer Generated Images," Communications of the ACM , Vol. 19, No. 10 (Oct 1976); Association for Computing Machinery, Inc., New York, 1976, pp. 542|547. Blinn, James F., \Simulation of Wrinkled Surfaces," ACM Computer Graphics , Vol. 12, No 3.
10 Detailed Discussions This section contains more detailed discussions of some selected texture mappingrelated topics below: \Discussion: MIP Map" \User Interface Considerations for Creating Filtered Texture Maps" \Parameterization" Discussion: MIP Map \MIP" stands for multum in parvo ; literally, \many things in a small place." Why use MIP maps? MIP maps are generally used to reduce the aliasing e ects that naturally take place with texture mapping.
10 How is a MIP map created? A MIP map is a pyramid of images with the base of the pyramid equal to the original source texture map. Each successive level of the texture map is created using a box lter for each texel in the next level. In other words, four texels in one level of the map (in a 222 square) are averaged to create one texel in the next, smaller level. Thus, each successive level in a MIP map is a quarter of area of the previous level.
How is a MIP map used? The values speci ed in the Sampling LUT determine how the MIP map is actually sampled to nd the appropriate color for a single pixel. The mini cation method speci es how the map should be sampled when one screen pixel maps to several texels and the magni cation method determines what to do in the case of multiple pixels mapping to a single texel.
10 Given these methods, the MIP map is sampled according to the following formula: The number of texels in the base map that are covered by a single pixel determines if the mini cation method or magni cation method should be used. The number of texels also determines which level should be sampled if the mini cation method speci es a level other than the base level.
10 User Interface Considerations for Creating Filtered Texture Maps Some PEXlib implementations require texture map dimensions to be a power of two and/or require square maps (your implementation's requirements can be determined by PEXGetImpDepConstants). The utilities PEXExtCreateFilteredTM and PEXExtCreateFilteredTMFromWindow will resize the maps if demanded by the implementation.
10 Troubleshooting This troubleshooting section is separated into several sections; choose the desired texture-mapping subject matter. Frequently-Asked Questions Q. What areas should be checked if textures fail to render? A.
PEXExtIDPowerOfTwoTMSizesRequired and PEXExtIDSquareTMRequired. Note that the utilities PEXExtCreateFilteredTM and PEXExtCreateFilteredTMFromWindow can Q. A. Q. A. Q. A. be used to ensure the implementation constants are met. Data from the utilities for texture coordinates or ltered texture maps was invalid. Be certain to check the return status of these functions to determine the correctness of their data.
10 Q. Why do the scaling matrices in the TMCoordSrc LUT behave inversely to their expected e ect on a texture; for example, scaling values greater than 1 create multiple copies of a map on my surface? A. Texture coordinate space is ideally de ned between zero and one [0.0,1.0). When a texture coordinate is scaled by a value greater than one in the orientation matrix of a TMCoordSrc LUT entry, its value spans a texture coordinate space distance greater than or equal to one.
10 Texture Maps Q. How does one avoid or x the unpleasant texture seams which may occur on an object? A. Texture seams can become visible when: The boundary condition PEXExtTMBoundaryCondWrap is active in a given direction and opposing edges of a texture map do not match in color. To correct this, ensure the opposing edges of a map (top=bottom, left=right) share the same color. This can be performed in many interactive image processing and paint packages.
10 Q. Why does my input texture map appear to be inverted (upside down) on the textured surface? A. The problem may be caused by the ordering of your texture map scanlines. PEXlib texture maps assume to have their origins (0,0) at the lower left edge of the quadrant. Many formats (such as X) assume the upper left. Maps should be inverted in scanline order if their origins are in con ict with PEXlib.
Q. Why do certain primitives (the extended primitives PEXExtFillAreaSetWithData, PEXExtSetOfFillAreaSets, PEXExtTriangleStrip , and PEXExtQuadrilateralMesh; or the OCC alternatives PEXOCCFillArea, PEXOCCFillAreaSet, PEXOCCIndexedFillAreaSets, PEXOCCTriangleStrip, and PEXOCCQuadrilateralMesh) sometimes appear to have discontinuous textures applied across their surfaces, even though the texture coordinate utilities worked on the primitive all at once? A.
10 Standard Mapping Q. What operations a ect the apparent position of a texture on the surface of a primitive? A. The apparent position of a texture on a surface occurs due to the location of texture coordinates within the 2D space of a standard texture map. Texture coordinates select regions of the texture to \pin" to the vertices of a facet.
Q. What advantage does PEXExtTMParamReflectSphereWC o er over PEXExtTMParamReflectSphereVRC? A. If PEXExtTMParamReflectSphereWC is supported in your implementation, then re ections on a surface will change with respect to location of the view in world coordinates (WC). As an object or viewpoint changes position, so does the apparent re ection along its surface.
10 Performance Q. Under what conditions will my texture mapping performance be the best? A. Several steps can be taken to improve texture mapping throughput in the system: Attempt to render all extended surface primitives using the same set of textures at the same time. Activating di erent textures on a per-primitive basis can be costly. Minimize the mixture of surface primitives going to PEX.
10 Visual Quality Q. My texture map has many ne details in it, some only one texel wide (such as lines). When I rotate the surface it is applied to, these lines tend to break up or ash. What can I do to correct this? A. Texture mapping is all about sampling theory. Essentially, the more discrete samples taken, the better the reconstruction of the original, continuous signal. The artifact you are experiencing is sampling \aliasing," the loss of reconstruction information.
10 Q. Portions of my textured surface appear to be blotched with regions of blurred detail. What are they and how can I correct this? A. The artifact witnessed here occurs due to the design of the Mip Map antialiasing lter. As a renderer attempts to approximate an area of texels to sample in texture space, it selects di erent map levels to sample. The regions of blurred detail are visible transitions which are occurring due to the current sampling method.
A Sample Output from xdpyinfo and pexdpyinfo Introduction In \Determining A Server's Features" in Chapter 6, you were introduced to two helpful utilities, xdpyinfo and pexdpyinfo. Sample output from these are illustrated here for an HP 9000 Model 725/100 with HP Visualize-24 graphics: xdpyinfo name of display: hpsys00:0.0 version number: 11.
XIE XInputExtension XTEST XTestExtension1 default screen number: number of screens: 1 A 0 screen #0: dimensions: 1280x1024 pixels (342x273 millimeters) resolution: 95x95 dots per inch depths (4): 1, 8, 12, 24 root window id: 0x2a depth of root window: 8 planes number of colormaps: minimum 1, maximum 4 default colormap: 0x28 default number of colormap cells: 256 preallocated pixels: black 0, white 1 options: backing-store YES, save-unders YES largest cursor: 64x64 current input event mask: 0x0 number of v
significant bits in color specification: 8 bits visual: visual id: 0x24 class: DirectColor depth: 12 planes available colormap entries: 16 per subfield red, green, blue masks: 0xf00, 0xf0, 0xf significant bits in color specification: 8 bits visual: visual id: 0x25 class: TrueColor depth: 12 planes available colormap entries: 16 per subfield red, green, blue masks: 0xf00, 0xf0, 0xf significant bits in color specification: 8 bits visual: visual id: 0x26 class: DirectColor depth: 24 planes available colormap e
pexdpyinfo PEX information for hpsys00:0.
Type 2: Type 3: Type 4: PEXETInteriorStyle Type 0: Type 1: Type 2: Type 3: Type 4: PEXETLightType Type 0: Type 1: Type 2: Type 3: PEXETLineType Type 0: Type 1: Type 2: Type 3: Type 4: Type 5: Type 6: Type 7: PEXETMarkerType Type 0: Type 1: Type 2: Type 3: Type 4: Type 5: Type 6: Type 7: Type 8: PEXETModelClipOperator Type 0: Type 1: PEXETParaSurfCharacteristics Type 0: Type 1: PEXETPickDeviceType Type 0: Type 1: PEXETPolylineInterpMethod Type 0: Type 1: PEXETPromptEchoType PEXETReflectionModel Type 0: Type
A Type 2: Type 3: PEXETRenderingColorModel Type 0: PEXETSurfaceApproxMethod Type 0: Type 1: Type 2: Type 3: PEXETSurfaceEdgeType Type 0: Type 1: Type 2: Type 3: PEXETSurfaceInterpMethod Type 0: Type 1: PEXETTrimCurveApproxMethod Type 0: PEXETEscape Type 0: Type 1: Type 2: Type 3: Type 4: Type 5: Type 6: Type 7: Type 8: Type 9: Type 10: Type 11: Type 12: Type 13: Type 14: Type 15: Type 16: Type 17: Type 18: Type 19: Type 20: Type 21: Type 22: Type 23: Type 24: Type 25: Type 26: Type 27: PEXETPickAllMethod
Type 0: PEXETPickOneMethod Type 0: ExtEnumType Type 0: Type 1: Type 2: Type 3: Type 4: Type 5: Type 6: Type 7: Type 8: Type 9: Type 10: Type 11: Type 12: Type 13: Type 14: Type 15: Type 16: Type 17: Type 18: Type 19: Type 20: Type 21: Type 22: Type 23: Type 24: ExtOC Type 0: Type 1: Type 2: Type 3: Type 4: Type 5: Type 6: Type 7: Type 8: Type 9: Type 10: Type 11: Type 12: Type 13: Type 14: Type 15: Type 16: Type 17: Type 18: All (1) (0x1) Last (1) (0x1) ExtEnumType (36864) (0x9000) ExtOC (36865) (0x9001) E
A Type Type Type Type Type Type Type Type Type Type Type Type Type ExtPC Type Type Type Type Type Type Type Type Type Type Type Type Type Type Type ExtRA Type Type Type Type Type Type Type ExtLUT Type Type Type Type ExtID Type Type Type Type Type Type A-8 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: HP_OCSetDeformationMode (34561) (0x8701) HP_OCSetDeformationValueLocation (34562) (0x8702) HP_OCSetCappingPlanes (34563) (0x8703) HP_OCPolylineSetWithData (34564) (0x8704) HP_OCMarkersWithData (34565)
Type 6: Type 7: ExtTMRenderingOrder Type 0: Type 1: ExtTMCoordSource Type 0: ExtTMCompositeMethod Type 0: Type 1: Type 2: ExtTMTexelSampleMethod Type 0: Type 1: Type 2: Type 3: Type 4: Type 5: ExtTMBoundaryCondition Type 0: Type 1: Type 2: Type 3: ExtTMClampColorSource Type 0: Type 1: ExtTMDomain Type 0: Type 1: ExtTexelType Type 0: Type 1: Type 2: Type 3: Type 4: Type 5: ExtTMParameterizationMethod Type 0: Type 1: Type 2: Type 3: ExtTMType Type 0: ExtTMPerspectiveCorrection Type 0: Type 1: ExtTMSampleFrequ
A Type 0: Type 1: Type 2: ExtPrimitiveAAMode Type 0: ExtPrimitiveAABlendOp Type 0: Type 1: ExtLineCapStyle Type 0: ExtLineJoinStyle Type 0: Type 1: HP_TransparencyMethod Type 0: HP_AlphaBlendFunction Type 0: Type 1: ExtTMResourceHintNone (36864) (0x9000) ExtTMResourceHintSpeed (36865) (0x9001) ExtTMResourceHintSpace (36866) (0x9002) ExtPrimAANone (36864) (0x9000) ExtPrimAABlendOpImpDep (36864) (0x9000) ExtPrimAABlendOpSimpleAlpha (36865) (0x9001) ExtLineCapStyleButt (36864) (0x9000) ExtLineJoinStyleImpDep
PEXIDMaxNameSetNames: PEXIDMaxModelClipPlanes: PEXIDMaxNonAmbientLights: PEXIDMaxNURBOrder: PEXIDMaxTrimCurveOrder: PEXIDMaxHitsEventSupported: PEXExtIDMaxTextureMaps: PEXExtIDMaxFastTMSize: PEXExtIDPowerOfTwoTMSizesRequired: PEXExtIDSquareTMRequired: HP_IDDeformationSupported: HP_IDCappingPlanesSupported: HP_IDInterferenceSupported: HP_IDPolygonOffsetSupported: 2147483647 6 15 6 6 YES 8 0 YES NO YES YES YES NO A PREDEFINED LOOKUP TABLE ENTRIES PEXLUTColorApprox Maximum Entries: Predefined Entries: Entry
value red: green: blue: A Entry 2 type: value red: green: blue: Entry 3 type: value red: green: blue: Entry 4 type: value red: green: blue: Entry 5 type: value red: green: blue: Entry 6 type: value red: green: blue: Entry 7 type: value red: green: blue: PEXLUTDepthCue Maximum Entries: A-12 1.000 1.000 1.000 PEXColorTypeRGB 1.000 0.000 0.000 PEXColorTypeRGB 1.000 1.000 0.000 PEXColorTypeRGB 0.000 1.000 0.000 PEXColorTypeRGB 0.000 1.000 1.000 PEXColorTypeRGB 0.000 0.000 1.000 PEXColorTypeRGB 1.000 0.
Predefined Entries: Entry 0 mode: front_plane: back_plane: front_scaling: back_scaling: color type: value indexed: PEXLUTEdgeBundle Maximum Entries: Predefined Entries: Entry 1 edge_flag: type: width: color type: value indexed: PEXLUTInteriorBundle Maximum Entries: Predefined Entries: Entry 1 style: style_index: reflection_model: interp_method: bf_style: bf_style_index: bf_reflection_model: bf_interp_method: surface_approx method: u_tolerance: v_tolerance: color type: value indexed: reflection_attr ambient:
diffuse: specular: specular_conc: transmission: specular_color type: value indexed: bf_color type: value indexed: bf_reflection_attr ambient: diffuse: specular: specular_conc: transmission: specular_color type: value indexed: A PEXLUTLight Maximum Entries: Predefined Entries: Entry 1 type: direction x: y: z: point x: y: z: concentration: spread_angle: attenuation1: attenuation2: color type: value red: green: blue: 1.000 1.000 0.000 0.000 PEXColorTypeIndexed 1 (0x1) PEXColorTypeIndexed 1 (0x1) 1.000 1.
Maximum Entries: Predefined Entries: Entry 1 type: interp_method: curve_approx method: tolerance: width: color type: value indexed: PEXLUTMarkerBundle Maximum Entries: Predefined Entries: Entry 1 type: scale: color type: value indexed: 65535 (0xffff) 1 (0x1) 1 (0x1) 1 (0x1) A 1 (0x1) 1.000 1.000 PEXColorTypeIndexed 1 (0x1) 65535 (0xffff) 1 (0x1) 3 (0x3) 1.
A font_index: 65536 (0x10000) PEXLUTView Maximum Entries: Predefined Entries: 65535 (0xffff) 1 (0x1) Entry 0 clip_flags: clip_limits min x: y: z: max x: y: z: 7 (0x7) 0.000 0.000 0.000 1.000 1.000 1.
-hp-PEX stick-medium-r-normal-normal-0-0-0-0-p-0-iso8859-1 -hp-PEX simplex sans serif-medium-r-normal-normal-0-0-0-0-m-0-iso8859-1 -hp-PEX simplex sans serif-medium-r-normal-normal-0-0-0-0-p-0-iso8859-1 SUPPORTED PEX VISUALS Target 0 type: depth: visual: Target 1 type: depth: visual: Target 2 type: depth: visual: Target 3 type: depth: visual: Target 4 type: depth: visual: Target 5 type: depth: visual: Target 6 type: depth: visual: Target 7 type: depth: visual: Target 8 type: depth: visual: Target 9 type: de
FINAL TRIM SIZE : 7.5 in x 9.
Glossary Abscissa Glossary The value representing the distance of a point from the Y-axis in the Cartesian coordinate system, measured along a line parallel to the X-axis. (Compare \Ordinate".) Active Texture List A list of binding table entries which speci es the currently active textures within the rendering pipeline. All appropriate primitives will receive texture mapping e ects sequentially evaluated from this list. Two separate lists exist for front- and backface distinguishing.
information for an X texture resource, texture coordinates for each primitive, color composition rules, and texture map sampling and quality controls. (See \Binding LUT" in Chapter 9). Boundary Condition: Clamp Absolute When a texture coordinate accesses a texel outside of the texture map, texturing is discontinued and the primitive's existing color data is used. (See \Sampling LUT" in Chapter 9.
Composition Type: Decal If alpha is not included in the texture map, the texture map color replaces the primitive's existing color. If, on the other hand, alpha is speci ed in the texture map, the following equation is used to determine the nal blended color: Cout = Cin 2 (1 0 ta ) + tc 2 ta where Cin is the primitive's existing color, ta is the texture map alpha and tc is the texture map color. (See \Composition LUT" in Chapter 9.
than one screen pixel maps to one texture map texel. (See \Sampling LUT" in Chapter 9.) Mini cation Method The process used to determine the nal color for a screen pixel when one screen pixel maps to more than one texture-map texel. (See \Sampling LUT" in Chapter 9.) MIP Map A pre-computed area-sampling mechanism which xes the cost of approxiGlossary mating the average color over a large number of pixels in a texture image.
Preparation The data-processing phase before rendering where texture data are loaded and area primitives with data are \surface parameterized" with texture coordinates per vertex. Projection Object A standard volume used in calculation of texture coordinates. A primitive is conceptually placed at the center of a projection object and each of the primitive's vertices are projected onto the projection object. The intersections of the vertices with the projection object determine the texture coordinates.
Texture Map A 1D, 2D, or 3D data set consisting of \texels" (or texture elements). A 1D texture map is an array of values; a 2D texture map is a two-dimensional image, and a 3D texture map is a set of 2D texture maps. HP PEX supports 1D and 2D texture maps. (See texel.) Texture Mapping A rendering e ect which enhances the surface detail of an area primitive for usually less cost than explicitly modeling the information.
Index Index 3 3D Graphics Application Programmer Interface, 5-5 3D Graphics Performance, 5-1 3D Wireframe, 6-74 A Abscissa, Glossary-1 ACM Computer Graphics, 10-26 Active Texture List, Glossary-1 Alpha Blending, Glossary-1 Alpha Transparency, Glossary-1 Animation, DBE and MBX, 6-62 Anti-aliasing, Glossary-1 Antialiasing, 6-48 Application Programmer Interface, 3D, 5-5 Application, SPU and Graphics, 5-2 Archive Math Libraries, 5-23 Area Primitives and Attributes, 6-51 Attributes, 5-13 Attribute Suppression
Approximation Lookup Tables, 6-77 Avoiding ashing, 3-16 Avoiding Flashing, 6-26 Con guration Utilities, 6-27, 6-29, 6-36 Dithering, 6-37 Flashing, 2-4, 3-15, 3-19, 6-21, 6-25, 6-26 Lookup Tables, 6-77 Portability and Interoperability, 6-24 Ramp, 6-22 Recovery, 3-19 Support, 6-18 Support in HP PEX, 6-26 Colormap Issues, 6-24, 6-27, 6-29 CRX, 6-36 Color ramp, 6-18 Color Ramp, Glossary-2 Color Specifying, Using #rgb , 3-13 Communications of the ACM, 10-26 Compiler Options, 5-23 Compiling and Running Program Ex
Index HPPEX_CLIENT_PROTOCOL, 3-3, 3-9 HPPEX_DHA_AUTO_COLOR_APPROX, 3-9, 3-14 HPPEX_DHA_COMPLIANCE_MODE, 3-9 HPPEX_DHA_ECHO_COLOR, 3-9 HPPEX_DHA_HIGHLIGHT_COLOR, 3-9 SB_X_SHARED_CMAP , 3-9 Environment Variables Dtlogin*environment, 3-12 HP_ENABLE_TRANSPARENT_MODE, 3-12 Setting, 3-9 Unsetting, 3-9 Why To Use Them, 3-1 Xconfig, 3-12 Error Checking and Reporting, 3-23 Error Codes, 6-3 Error condition for attributes and primitives (new), 7-32 Error Handling, 6-84 Error Message Files stderr, 3-23 XErrorDB,
H Hardware Z bu er, 5-3 Hatch Styles, 6-51 Header Files, 4-1 Help, Hypertext, 1-7 Hidden Line and Hidden Surface Removal, 6-75 Highlight Color, 8-8 HLSHSR, 6-75 $HOME/.profile, 3-12 HP_DISABLE_COLOR_RECOVERY, 3-19 Setting, 3-9 HP_ENABLE_TRANSPARENT_MODE Setting, 3-9 Setting Environment Variables, 3-12 HP Escape Request, 6-72 HP PEX 5.1 Examples, 7-23 HP PEX 5.1 Output Commands, Generating, 7-22 HP PEX5.1v3, Background Information, 7-1 HP PEX5.1v3, Description, 7-2 HP PEX5.1v3 Overview, 7-1 HP PEX5.
Index J O \jpeg" le format, 10-4 \jpg" le format, 10-4 OCC functions, simpli ed for primitive OCs, 7-20 OCC interface, 5-20 OC Context, 7-5 Online Documentation, 5-12 On-Line Information Changing Printer Settings, 2-6 Compiling and Running Examples, 1-13 Default Display Settings, 2-7 File Structure, 2-7 Overview, 1-7 Printing Settings, 2-6 On-Line Reference Information, 2-7 Operating Methods A ect on Performance, 3-3 Selecting, 3-3 Selection Progression, 3-3 Optimization, GPC Quarterly, 5-13 Ordinate, G
Analysis Tools, HP-UX, 5-8 Benchmarks, 5-6 Bottlenecks, 5-7 Data, published, 5-11 Double-bu ering, 5-3 Graphics/CPU, 5-4 Hardware Z bu er, 5-3 Information, 5-9 Non-graphics bottlenecks, 5-22 Overlay planes, 5-3 Rasterization of primitives, 5-3 Texture mapping, 5-4 Window size as a factor, 5-16 Performance Hints, 1-12 Performance Recommendations, 6-85 Compliance Mode, 3-14 Fast Macros, 6-85 Permission Features, Using, 7-29 PEX5.
Index PEXlib, pro led, 5-10 PEXListFonts , 6-56, 6-57 PEXListFontswithInfo, 6-56 PEXLoadFont, 6-56 PEXLUTColor, 6-37 pexman, 1-8 adding to PATH, 2-7 PEX Product Developer's Environment, 1-3 Run-Time Libraries, 1-3 PEX Protocol, 3-7 PEXSetInteriorStyle routine, 9-30 PEX Speci cs, 5-17 pexutcmap.
PEXExtTMCoordQuadrilateralMesh, 9-19 PEXExtTMCoordSetOfFillAreaSets, 9-19 PEXExtTMCoordTriangleStrip , 9-19 PEXExtTriangleStrip, 9-30 PEXFreeEnumInfo, 9-3 PEXGetEnumTypeInfo, 9-3 PEXGetImpDepConstants , 9-3 PEXSetInteriorStyle, 9-30 S Sampling Lookup Table, Glossary-5 Sampling of color space, 6-22 SB_X_SHARED_CMAP, 3-15, 6-26 Setting, 3-9 SearchContext, 6-2 Search context requests, 6-73 Searching, 6-83 Server Files, 2-12 SERVER_OVERLAY_VISUALS, 6-28 Setting Up, 10-10 Setting Up LUTs, 10-22 Setup of Tex
Index Texture Mapping, Step 3. Geometry Preparation, 10-19 Texture Mapping, Step 4. Set up Texture Mapping Lookup Tables (LUTs), 10-22 Texture Mapping, Step 5. Render, 10-24 Texture Mapping, Step 6. Clean Up, 10-25 Texture Mapping, Texture Preparation, 9-11 Texture Mapping Tutorial, 10-1 Texture Mapping, Uses, 10-1 Texture Preparation, 10-11 Texture Preparation step of Texture Mapping, 9-11 Textures, Prede ned, 10-7 Textures, Sources, 10-6 The NPC Subvolume and Viewport, 6-76 /tmp/update.
Xconfig Setting Environment Variables, 3-12 xdpyinfo, 2-4, 6-2 XErrorDB, 3-23 xhpcmap program, 3-18 \xpm" le format, 10-4 X Protocol Behavioral Di erences, 3-7 Index-10 \xwd" le format, 10-4 X Window System If You Reinstall, 2-8 Z Z-Bu er Block Operations, 7-33 Z-Bu er Block Operations, Background Information, 7-33