XGL Architecture Guide
Total Page:16
File Type:pdf, Size:1020Kb
XGL Architecture Guide 2550 Garcia Avenue Mountain View, CA 94043 U.S.A. A Sun Microsystems, Inc. Business 1995 Sun Microsystems, Inc. 2550 Garcia Avenue, Mountain View, California 94043-1100 U.S.A. All rights reserved. This product or document is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation. No part of this product or document may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any. Portions of this product may be derived from the UNIX® system, licensed from UNIX System Laboratories, Inc., a wholly owned subsidiary of Novell, Inc., and from the Berkeley 4.3 BSD system, licensed from the University of California. Third-party software, including font technology in this product, is protected by copyright and licensed from Sun’s suppliers. RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR 52.227-19. The product described in this manual may be protected by one or more U.S. patents, foreign patents, or pending applications. TRADEMARKS Sun, Sun Microsystems, the Sun logo, SunSoft, the SunSoft logo, Solaris, SunOS, OpenWindows, DeskSet, ONC, ONC+, NFS, and XGL are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. UNIX is a registered trademark in the United States and other countries, exclusively licensed through X/Open Company, Ltd. OPEN LOOK is a registered trademark of Novell, Inc. PostScript and Display PostScript are trademarks of Adobe Systems, Inc. All SPARC trademarks are trademarks or registered trademarks of SPARC International, Inc. in the United States and other countries. SPARCcenter, SPARCcluster, SPARCompiler, SPARCdesign, SPARC811, SPARCengine, SPARCprinter, SPARCserver, SPARCstation, SPARCstorage, SPARCworks, microSPARC, microSPARC-II, and UltraSPARC are licensed exclusively to Sun Microsystems, Inc. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc. The OPEN LOOK® and Sun™ Graphical User Interfaces were developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. Sun holds a non-exclusive license from Xerox to the Xerox Graphical User Interface, which license also covers Sun’s licensees who implement OPEN LOOK GUIs and otherwise comply with Sun’s written license agreements. X Window System is a trademark of X Consortium, Inc. THIS PUBLICATION IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THIS PUBLICATION COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES ARE PERIODICALLY ADDED TO THE INFORMATION HEREIN. THESE CHANGES WILL BE INCORPORATED IN NEW EDITIONS OF THE PUBLICATION. SUN MICROSYSTEMS, INC. MAY MAKE IMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/OR THE PROGRAMS(S) DESCRIBED IN THIS PUBLICATION AT ANY TIME. Please Recycle Contents Preface. xiii 1. Introduction to XGL . 1 Introduction to the XGL Product . 1 Running an Application in the X Window Environment . 2 Introduction to the XGL Programming Model. 4 What Is an XGL Object? . 4 How the XGL Programming Interface Works . 5 XGL Object-Oriented Programming . 8 Overview of XGL Functionality. 9 Opening and Closing the XGL Library. 9 Graphical Display . 9 Primitives . 11 Graphical Context . 12 Transformations. 14 XGL Viewing Pipeline. 14 iii Color . 16 Lighting and Shading . 18 Stroke Fonts . 18 Raster Text . 18 Line Patterns. 19 Geometry Caching. 19 NURBS Curves and Surfaces . 20 Texture Mapping . 20 2. Overview of the XGL Architecture . 21 XGL Architecture Design Goals . 22 Basic Components of the XGL Architecture . 22 Device-Independent Library . 23 Graphics Pipelines. 23 Overview of the Device Pipeline Architecture. 28 Architecture at the API Level. 29 Internal Pipeline Architecture . 29 Software Pipeline and Pipeline Switching . 34 Handling Context State Changes. 34 First Things First: What Is Context?. 35 Explicit XGL State Changes . 36 Intraprocess State Changes. 36 Window System Interaction . 37 Color . 39 3. XGL Class Structure . 41 iv XGL Architecture Guide—November 1995 Overview of the XGL Class Structure . 41 Device-Independent Classes. 42 Classes That Implement the XGL API. 43 Classes That Provide Internal Utility Functions . 45 Device Pipeline Classes. 48 Pipeline Library Class Hierarchy. 49 Device Pipeline Manager Class Hierarchy . 51 Device-Dependent Device Class Hierarchy . 52 Pipeline-Context Class Hierarchy . 53 Classes for Internal Data Storage. 55 4. Object Interactions . 57 Opening XGL . 57 How API Calls Are Mapped to XGL Internal Calls. 58 Instantiation of API Objects . 58 System State Object and API Object Lists. 59 What Is a Device Object? . 60 What Is a Context Object?. 61 Device and Context Association . 62 How the Pipelines Are Created and Managed. 64 The XGL Environment Is Set Up . 64 A Device Object Is Created. 65 A Context Object Is Created . 66 The Device Is Associated With the Context . 66 Object Communication . 68 Contents v API Object Relationships . 68 Architecture of Object Relationships. 69 Object Registration: The User List . 70 Message Passing . 73 Destroying Objects and Closing XGL . 75 Destroying the Device Object. 75 Destroying the Context Object . 75 Closing XGL . 76 5. Rendering and Handling State Changes . 77 Goals of the Rendering Architecture . 77 How Rendering Works . 78 What Is the opsVec Array? . 79 Device Pipeline Options for Rendering . 81 More on the Rendering Architecture. 82 Context State Changes. 83 State Changes From Attribute Setting. 84 State Changes From XGL Object Message Passing . 86 View Model Derived Data . 88 Changes in Context Stroke Attributes . 92 Device State Changes . 94 Rendering Into Backing Store. 95 Architecture of Backing Store. 95 Creating a Shadow Device . 97 Rendering Into the Backing Store Device . 99 vi XGL Architecture Guide—November 1995 Propagation of API Changes to the Backing Store Device . 103 Backing Store Support for the Z-Buffer and Accumulation Buffer. 103 6. Error Handling . 105 Design Goals. 105 Overview of Error Handling . 105 External Error Handling Mechanism . 106 Error Notification Function . 106 Error Types and Categories . 107 Internal Error Handling Mechanism . 109 7. XGL Coding Guidelines . 111 Naming Conventions for C++ Constructs . 111 Naming Conventions for C++ Internal Classes . 115 Coding Conventions for set() and get() Interfaces . 116 Conventions for set() Member Functions . 116 Conventions for get() Member Functions. 117 Index . ..