| United States-English |
|
|
|
![]() |
HP PEX Implementation and Programming Supplement: HP9000 Series 700 Color Workstations > Chapter 6 Writing HP PEXlib Programs Introduction |
|
This chapter provides you with recommendations and specific details of the HP PEX implementation that affect 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 sacrificing performance. To succeed at this, you may want, for example, to add PEXlib inquiries to your program that will enable it to determine which protocol version is supported by the server, attribute values that are supported, the visuals that you may use with PEX, as well as other details of implementation such as the number of supported line widths. The information and examples that you need to accomplish this is described in this and following chapters in this book as well as a companion publication, Portable Programming with CGE PEX 5.1. (More information and examples of specific PEXlib inquiries are provided for you in Chapter 24, "Determining a Server's Features" in PEXlib Programming Manual.) The Portable Programming with CGE PEX 5.1 was written specifically to assist you in creating highly portable 3D graphics applications on platforms supporting the Common Graphics Environment, including HP. It contains tools and utilities that you can use to develop portable and interoperable applications more easily. 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[12] 〈contrib〉/bin/X11. See sample output in Appendix A “Sample Output from xdpyinfo and pexdpyinfo ”. An HP PEX example program, pexdpyinfo, displays detailed information on the PEX extensions on your work station; information such as the enumerated types, implementation-dependent constants, lookup table entries, and supported PEX visuals for a particular display. See sample output in “pexdpyinfo”. In order to use this utility, you'll first need to use the Makefile to build the executable. See the README file in 〈hp-examples〉 for instructions. See the file pexdpyinfo.spec for usage details. The file pexdpyinfo.design contains design information and pexdpyinfo.c, the source code, for developers interested in extending the capabilities of the utility. As described in the PEXlib Programming Manual, Chapter 24, the extension information returned from PEXInitialize and PEXGetExtensionInfo verifies that a PEX extension exists within the PEX server in order to set PEXlib variables and establish communication with the server. HP PEX supports the Immediate Mode subset. HP PEX also supports the Structure Mode rendering subset of PEX functionality with all but the Search Context requests. This means that calls to SearchContext entrypoints (except to issue protocol to another server) will report a BadImplementation error. Calls to Workstation or PickMeasure entrypoints will report a BadRequest error. The Workstation and PickMeasure entry points do not emit protocol. Search context request protocol is generated and can be sent to servers that do support those requests. Errors are detected and reported by the client. Your program can determine which subsets are supported by a PEX server in an interoperable way with PEXGetExtensionInfo:
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-specific error codes that can be returned from the PEXInitialize function. We recommend that you print the error string which is returned in your program for more information needed to determine the cause of the error. Table 6-1 PEXInitialize Error Codes
Table 6-2 PEXInitialize Error Codes
The PEX extension information pointer returned from PEXInitialize will be valid only if PEXInitialize succeeds or the error PEXBadProtocolVersion is generated. Any other error that occurs in PEXInitialize will cause the PEX extension information pointer to be NULL. Enumerated types define values used to define attributes such as marker types (dot, asterisk, circle, or "×"). 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. For writing interoperable programs it is best to inquire which values are supported by using the PEXGetEnumTypeInfo inquiry rather than relying on documentation from vendors of vendor-specific support.
Table 6-3 Enumerated Type Inquiry Parameters
For example, you may use the enumerated type descriptors to inquire which double-buffering escapes are supported. This information is covered earlier in this chapter in “Inquiring Supported Escapes ”. 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 defines additional enumerated types to list extension features for which PEXlib 5.1 does not define 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 files for lists of extension enumerated types. Table 6-4 Enumerated Types
There are other PEX values in addition to enumerated types that vary among implementations, as allowed by the PEX standard. Implementation-dependent constants define 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. As with other implementation-dependent features, it is best to inquire about supported implementation-dependent constants using the standard PEXlib inquiry, PEXGetImpDepConstants.
Table 6-5 Implementation Dependent Constants Inquiry Parameters
This table lists some of the implementation-dependent constants that are supported in HP PEX. For an exhaustive list, see the include files PEX.h, PEXExt.h, PEXlib.h, and PEXHPlib.h. Table 6-6 Implementation-Dependent Constants
HP PEX supports one GSE, used to enable or disable line and edge antialiasing (see “Line Types ”). This is not a standard feature (there are no standard GSEs specified by PEX), but may have value for your application. The constants and data structure for the PEXlib interface are defined in the header file PEXHPlib.h. 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 affect 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. Other escapes are documented in other relevant sections of this manuals. HP PEX also supports the Structure Mode rendering subset of PEX functionality with all but the Search Context requests. These functions emit protocol but the HP PEX server does not process them and will generate an error upon receiving them. Table 6-7 Title not available (Search Context Requests )
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-8 Unsupported Subset Entrypoints
The O'Reilly PEXlib Programming Manual, Chapter 3, "Getting Started," is a good starting point for learning to use features of PEXlib as well as inquiring PEX extension information, enumerated types, and specific implementation-dependent constants. You'll also need to learn HP implementation details that are covered in this and the following chapters. 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. All the normal requirements for achieving proper ordering of rendering and windowing operations in X programs also apply to PEXlib programs. In particular, note that some kinds of requests are re-routed to the window manager (for example, XConfigureWindow). For these requests, it is good practice to wait for the proper type of X event to confirm that the operation has been completed before rendering further in the window. [12] The actual pathname of this directory depends on the file system structure. See the Graphics Administration Guide for details. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||