Contained Within
Find More Documentation
Featured Support Resources
| Scarica il manuale in formato PDF
Introduction to XGL
1
Introduction to the XGL Product
- XGL(TM) is a foundation library of two-dimensional (2D) and three-dimensional (3D) graphics functions designed to support a wide variety of geometry-based graphics applications. XGL provides direct mapping of graphics functionality to underlying hardware and implicitly uses hardware graphics acceleration whenever possible. Where hardware acceleration does not exist, XGL provides software emulation, allowing applications to run and produce nearly identical results on all platforms and graphics devices.
- For application developers, the XGL library provides immediate-mode rendering and separate, complete 2D and 3D rendering pipelines. XGL has a rich set of graphics primitives as well as view and modeling transform support. Standard features include 2D and 3D primitive support (such as lines and polygons); depth cueing, lighting and shading; NURBS curve and surface support; and direct and indirect color model support. Advanced features include transparency, antialiasing, texture mapping, stereo, and accumulation buffer for motion blur and other special effects. Multi-primitive operators permit batching of simple primitive calls into groups. Besides providing a rich application programmer's interface (API) for application developers, the XGL library also serves as a foundation library for other graphics APIs, such as PHIGS, PEX, and GKS.
- For developers of hardware graphics devices, the XGL product provides an open, well-defined graphics porting interface (GPI) in a loadable device pipeline architecture. This architecture enables hardware developers to build
- display devices that optimize specific features of XGL. If a hardware vendor releases a new graphics device and provides an XGL device handler for that device, an application compiled for XGL will work without recompilation on the new device. By using the XGL library as a foundation-level interface, graphics devices under the Solaris(TM) environment will support any XGL application, and applications and graphics APIs written to the XGL library will run with any graphics device under the Solaris environment.
- The XGL library resides directly above the hardware and firmware of the display device and graphics accelerator, minimizing software overhead within the XGL graphics pipeline. The relationship between XGL applications, high-level programming interfaces, and the XGL foundation library is illustrated in Figure 1-1.

Figure 1-1
Running an Application in the X Window Environment
- XGL runs within a window environment managed by an X11-R5 compatible server. XGL uses Sun's Direct Graphics Access (DGA) display technology, available in the OpenWindows environment, to accelerate XGL applications. DGA arbitrates access to the display screen between XGL and the X11 window system.
- DGA technology enables XGL applications to achieve high-performance graphics when the application is running on the same machine as the X11 server and the hardware has DGA support. DGA synchronizes with the X11
- server and allows XGL to send commands directly to the accelerator or frame buffer. This eliminates the overhead that results from building X11 protocol requests and passing them from the client to the server. An XGL program running locally with the server and using DGA is illustrated in Figure 1-2:

Figure 1-2
- When the XGL client program is running remotely, XGL uses Xlib or PEXlib to do all rendering. If the server includes the PEX extension and XGL has access to the PEX loadable library, XGL uses PEXlib to render. If PEX is not available, XGL uses Xlib for 2D rendering, and for primitives and rendering options that are not supported by Xlib, XGL does scan conversion to send the pixels through Xlib to the device. Figure 1-3 on page 4 llustrates remote rendering.

Figure 1-3
- DGA ensures that XGL drawing operations are synchronized with the server. It also preserves the integrity of the display when windows are resized, moved, or obscured. DGA is transparent to the XGL application programmer. Applications or new graphics interfaces layered on top of XGL automatically benefit from features provided through XGL, such as DGA and remote rendering through X11 protocol.
Introduction to the XGL Programming Model
- The XGL API is structured hierarchically through a series of abstract data types called classes (see Figure 1-4 on page 5). Applications can create instances of classes, where an instance of a class is an object. The class of an object determines the attributes it possesses and the operators that can act on it. XGL objects separate the application programmer from the specifics of the window system and the underlying hardware device. They present a consistent, device-independent graphics model that simplifies the work of the application programmer.
What Is an XGL Object?
- An XGL object is an abstraction of a graphics resource. Each object describes a virtual component of the graphics rendering system and contains the information necessary to perform graphics operations, such as defining a line pattern or rendering a polygon. Display devices, for example, are known to the XGL programmer as Window Raster Device objects. Graphics state information
- describing how XGL graphics primitives are drawn on the device is stored in a 2D Context or 3D Context object. Figure 1-4 illustrates the XGL class hierarchy from which graphics objects are derived.

Figure 1-4
- An XGL object is an instance of a class and contains state information (known as attributes in XGL) and member functions (known as operators) specific to its class. A class can be instantiated many times to create distinct objects that all belong to the class. Each object inherits its specific attributes and operators from its parent class. Operators perform predefined actions on objects of their parent classes.
How the XGL Programming Interface Works
- An XGL application follows the general format of Xlib or X toolkit programming, using the event-driven model of X applications for interaction handling. With either Xlib or X toolkit calls, the application first creates the window system objects that it needs, such as a window for graphics display, and then opens the XGL system. When XGL is opened, it automatically creates
- the System State object as well as internal objects that handle interactions between the device-dependent and the device-independent parts of the XGL system.
- To set up a framework for rendering, the application must create a Device object, which is an abstraction representing the display device, and a Context object, which controls all rendering actions on a device. These objects are created using an XGL object creation operator that takes attributes describing the object as input arguments, creates an instance of the object, and returns a handle to the object. The application program must associate the Device object with the Context object before geometry can be rendered. When the Context object and Device object are associated, the application can use XGL primitives to do rendering and can pass control of the program to Xlib or an X toolkit to process events.
- During the work session, the application can change Context attributes to change the display characteristics of geometry. It can render geometric data using XGL drawing primitives and create other objects as needed. For example, the application might want to create several Stroke Font objects to enable the use of different character sets, or create Line Pattern objects to provide the user with application-specific line patterns. Multiple Device objects, such as Window Raster and Memory Raster devices, can be associated with and disassociated from the Context object as needed for rendering. When the application exits XGL, the System State object destroys existing objects, frees resources, and then destroys itself, closing XGL.
XGL Attributes
- Attributes control much of the functionality of XGL, such as the appearance of rendered geometry, the way picking is handled, and the orientation of virtual device coordinate space. While some attributes are read-only, an application can change the value of most attributes at any time. Attributes are input as arguments to XGL operators, some of which take an attribute-value list as one of the input parameters.
XGL Operators
- XGL provides a set of operators that applications can use to create objects and modify the attributes of objects. XGL includes several types of operators: generic operators used with all API objects, geometry-rendering operators, utility operators, and object-specific operators. The generic operators, listed in Table 1-1, provide a consistent method of working with all XGL objects.
-
Table 1-1
| Operator | Description |
| xgl_object_create() | Creates an XGL object. |
| xgl_object_set() | Sets the value of an attribute. |
| xgl_object_get() | Gets the value of an attribute. |
| xgl_object_destroy() | Destroys an object. |
- The rendering operators are the XGL drawing primitives. XGL provides a wide range of drawing primitives, including polylines, text, and filled areas such as rectangles, quadrilateral meshes, multiple single-boundary polygons, and multiple-boundary polygons. Primitives are available to an application as operators of the Context object.
- Utility operators perform tasks such as clearing the Device viewport or copying blocks of pixels from a buffer in one Raster to a buffer in another Raster. Object-specific operators are provided for some objects; for example, the Transform object includes a set of operators that perform matrix operations.
Object Relationships
- The relationship between XGL objects is managed internally by XGL object-management functions. When an application creates a new object, it can establish an association between the new object and an existing object using the xgl_object_set() operator, a connecting attribute, and the handles of the two objects. Table 1-2 on page 8 lists objects that are associated with the Context and Device objects as graphics resources.
-
Table 1-2
| User object | Related object |
| Raster Device | System State
Color Map |
| Context | System State
Device
Transform
Line Pattern
Marker
Pcache
Stroke Font
Light (3D Context only)
Texture Map (3D Context only) |
XGL Object-Oriented Programming
- From the point of view of the architecture, XGL is an object-oriented system, since the internal code underlying the API adhers to the following basic principles of object-oriented programming:
-
- Objects consist of member data (attributes) and methods (operators).
- Objects derive from classes in a class hierarchy and inherit the data and functions of their parent classes.
- To the application programmer, however, XGL is an object-based programming model, since an application can only define instances of classes and cannot create new classes to extend the class hierarchy. The application can access an object only via its object handle and operators; the object's actual data structures are not accessible to the application.
Overview of XGL Functionality
- The XGL product is a software library that defines how graphics functions, such as transformations, lighting, shading, texture mapping, and other geometric operations, are performed. The library provides a full set of 2D and 3D primitives, which are listed in Table 1-3 on page 11. Broad coordinate-type support is provided for 2D and 3D pipelines, including:
-
- Integer, floating point, and double precision floating point types for 2D pipelines.
- Floating point and double precision floating point types for 3D pipelines.
- Additionally, the XGL library provides features such as dynamic tessellation of NURBS curves and surfaces, surface trimming of NURBS surfaces, geometry caching, and backing store support.
- The following sections provide a brief introduction to XGL functionality. For detailed information on the use of specific API object operators and attributes, see the XGL Programmer's Guide and the XGL Reference Manual.
Opening and Closing the XGL Library
- The XGL library is opened and closed by operators of the System State object. The System State object maintains information pertaining to all operations occurring during a single XGL session. Only one System State object can be created for any single XGL session.
- System State attributes provide information on the location of font data and allow the application to set the default path used by XGL to access stroke font data files used in the text primitives. System State attributes also adjust the degree of error handling XGL performs and allow the application to supply its own error-handling functions in place of the XGL default error function.
Graphical Display
- The XGL interface renders onto a graphical display through an XGL Device object and 2D or 3D Context objects. The display device is generally an X11 window linked to the XGL application through a window handle. The XGL application links the on-screen window to an XGL Raster Device object when the raster is created.
-

- The Device object is an abstraction of a drawing surface. It provides a framework for interacting with hardware graphics devices in an abstract manner. The Device class itself is not instantiated to objects; instead, it is subclassed to raster devices, which represent two-dimensional rectangular arrays of pixels, and non-raster devices, which represent images that are not displayed via pixels. Raster device classes are instantiated to provide the following objects:
-
- Window Raster Device object - This object represents an area of the frame buffer that XGL will write into.
- Memory Raster Device object - This object represents a block of memory allocated from main memory. The pixels composing a Memory Raster object are in the application's memory space.
- Non-raster objects are subclassed to provide Stream device objects. Stream devices provide a protocol-independent pipeline for creating formatted output such as Computer Graphics Metafile (CGM) output. The XGL Stream device maintains no protocol itself but relies on an instantiated third-party non-raster device pipeline to implement the appropriate output protocol data format. The XGl library includes CGM functionality that conforms to the ISO 8632:1985 standard.
Raster Attributes
- Raster attributes allow an application to determine raster height, width, and depth. The Raster depth attribute defines the number of bits used to specify the color of one pixel in an XGL Raster. The depth of a Window Raster is device dependent. For a Memory Raster, three depths are supported: 1, 8, and 32. The 1-bit depth is used for creating stipple patterns.
- The application can specify single or double buffering and can utilize hardware double buffering when it is available. If the hardware supports only a single buffer, color map double buffering can be performed. Backing store support can be enabled for a Window Raster; however, backing store and double buffering are not supported concurrently. The application can also set an attribute to specify a stereo window for rendering.
- An application can set or get the starting address of the array of pixels set aside for an XGL Memory Raster, including the Memory Raster's Z-buffer. This allows the application programmer to read and write pixel data directly.
Primitives
- The XGL library accepts a number of different representations of geometrical data, providing applications with flexibility in choosing an appropriate implementation. Data representation includes coordinate types and attributes associated with the rendered geometry. Most primitives can be rendered through both 2D and 3D pipelines. Available primitives are listed in Table 1-3.
-
Table 1-3
| Operators | Description |
| xgl_annotation_text() | Renders annotation text (2D or 3D). |
| xgl_multiarc() | Draws a list of arcs (2D or 3D). |
| xgl_multicircle() | Draws a list of circles (2D or 3D). |
| xgl_multi_elliptical_arc() | Draws a list of elliptical arcs (3D only). |
| xgl_multimarker() | Draws markers at a list of points (2D or 3D). |
| xgl_multipolyline() | Draws a list of unconnected polylines (2D or 3D). |
| xgl_multirectangle() | Draws a list of rectangles (2D or 3D). |
| xgl_multi_simple_polygon() | Draws a list of polygons (2D or 3D). |
| xgl_nurbs_curve() | Draws non-uniform B-spline curves (2D or 3D). |
| xgl_nurbs_surface() | Draws non-uniform B-spline surfaces (3D only). |
| xgl_polygon() | Draws a single polygon (2D or 3D). |
| xgl_quadrilateral_mesh() | Draws a quadrilateral mesh (3D only). |
| xgl_stroke_text() | Renders stroke text (2D or 3D). |
| xgl_triangle_list() | Draws a triangle strip, triangle star, or batch or unconnected triangles (3D only). |
| xgl_triangle_strip() | Draws a triangle strip (3D only). |
Graphical Context
- The Context object is the central object that holds information about the rendering of geometric data. Context attributes control the position and appearance of geometry when it is rendered. Context operators include the drawing primitives and a number of utility functions. The utility operators include raster functions and pixel functions. The Context object can be associated with other objects that serve as graphics resources for the Context, such as the Line Pattern object and the Light object.
Rendering Attributes
- Context graphics state attributes control many aspects of rendering, including the following:
-
- Line Characteristics - Context attributes set the polyline style to solid or patterned and define the color of a line. They also define the shape of the endpoints of lines and curves, set the line width scale factor, and define the shape of joins between line segments. An application can define a new line pattern by creating a Line Pattern object and attaching it to the Context object.
- Marker Characteristics - Context attributes define the size, color, and type of marker that is rendered. An application can define a new marker by creating a Marker object and attaching it to the Context object.
- Stroke Text Characteristics - Context text attributes define stroke text character height, width, spacing, and alignment. They also define text horizontal and vertical alignment, direction, and color. Multiple fonts can be attached to the Context object with Context attributes.
- Annotation Text Characteristics - Annotation text is text that is embedded in a plane parallel to the display surface. Context attributes define annotation text character height, character alignment, text alignment, and text direction.
- Transformation Characteristics - Context Transform attributes direct the conversion of geometric data from application coordinates to device coordinates. Transform objects are manipulated via Context object attributes.
- Surface Characteristics - Context attributes set the color used to fill surfaces and define the way in which surfaces are filled. They also enable hidden line and surface removal, control the drawing of silhouette edges around a
- surface, and define how surface normals are calculated when they are not provided in application data. The application can define a fill pattern for a surface by creating a Memory Raster object and attaching it to the Context for the front fill pattern or the back fill pattern.
-
- Surface Edge Characteristics - Context attributes set the edge style, color, and width characteristics of the edges of surfaces (rectangles, circles, polygons, or arcs). An application can define a new pattern for a surface edge by creating a Line Pattern object and attaching it to the Context with a Context edge attribute.
- Surface Lighting Characteristics (3D attributes) - A 3D Context attribute sets the number of lights available to the Context; XGL then creates or destroys lights to match the specified number. Existing lights can be turned off or on, and they can be positioned and aimed to illuminate graphical objects for a desired effect. Context attributes control the global rendering properties of materials, such as material color, and the reflection coefficients for the various components of reflected light. An application can also create its own array of lights by creating a Light object and attaching it to the Context object.
- Surface Shading Characteristics (3D attributes) - A 3D Context attribute determines how a surface is shaded by defining the object's illumination style. The following illumination styles are available:
· Objects can be drawn without lighting or color interpolation; in this case, the objects are drawn in their intrinsic color.
· Objects can be drawn without lighting but with colors interpolated from the object vertex colors.
· Objects can be drawn with lighting calculations performed at each facet; as a result, the entire object is drawn in the reflected color.
· Objects can be drawn with lighting calculations performed at each vertex. If illumination per vertex is requested, XGL draws the object by linearly interpolating the reflected colors at the vertices across edges and subsequently across scan lines.
- Surface Transparency (3D attributes) - Context attributes enable applications to render transparent surfaces. XGL provides screen-door and blended (two-pass) transparency. If the transparency method is screen-door, a device-dependent screen door (a mesh that allows rendering of only some of the surface's pixels) is applied to the primitive. If the transparency method is blended, blending equations determine how the surface pixel values are blended with the background color or existing pixel values.
-
- Curved Surface Characteristics - Context attributes enable the application to control the smoothness of curved surface tessellation, to specify static or dynamic surface tessellation, and to define the placement of isoparametric curves on the surface. Surfaces can be trimmed using NURBS curves defined with Context curve attributes.
- Depth Cueing (3D attributes) - 3D Context attributes define the type of depth cueing rendered, specify the color that the primitive will be modulated to as the depth increases, and define how the depth cueing interpolation is calculated.
- Accumulation Buffers - Context attributes specify the destination buffer for an accumulation operation and specify the amount of jittering for the accumulation. When jittered images are averaged together, the resulting image is effectively antialiased.
Transformations
- Geometric transformations specify a linear mapping from one coordinate space to another. An XGL Transform object represents a set of functions for transformation operations as well as a set of transformation matrices used to map geometry between coordinate systems on its way through the rendering pipeline. A transformation can be applied to the x, y, and z coordinates of geometric primitives using Transform objects. Data may be associated with a Transform object by loading a 4 . 4 matrix for a 3D transform or a 3 . 2 matrix for a 2D transform.
- The Transform operators concatenate new matrices with existing Transforms and perform a variety of other functions, such as copy a Transform or multiply two Transforms. See the XGL Programmer's Guide or the XGL Reference Manual for more information on the Transform operators.
XGL Viewing Pipeline
- The XGL viewing pipeline manages the transformation and rendering of geometric data from the application to the underlying display hardware. It moves geometric data along the viewing pipeline with a set of transformations and clipping attributes. During this process, lighting, depth cueing, shading, and transparency properties are applied. The XGL viewing model is based on the PHIGS model.
- The Context object includes information that specifies the mapping and clipping of geometric data between coordinate spaces. Each Context has its own set of Transforms to implement the mapping between the sequence of coordinate systems. All Transforms default to the identify transform. To change a Transform, an application can use the Transform operators to build a new matrix, or it can input the matrix directly into the Transform object. When the new matrix is input to the Context as the target of a Transform operator, the Context object becomes aware of the change to its pipeline.
- The application can update the following Transforms:
-
- Model Transform - The application controls the placement of each coordinate system in world coordinates with a transformation called the Model Transform. Although an application cannot access the Model Transform directly, it can change the Model Transform via attributes and transformations that set the Local Model Transform and the Global Model Transform. The Local Model Transform maps an element of the graphic scene to a global modeling space where the complete scene is assembled. The Global Model Transform maps the complete scene into world coordinate space. The Model Transform is the Local Model Transform preconcatenated with the Global Model Transform.
- Normal Transform (3D Contexts only) - 3D Context objects also have a Normal Transform, which maps normal vectors from model coordinates to world coordinates. The Normal Transform is the inverse of the Model Transform. XGL treats normal vectors as column vectors and points as row vectors.
- View Transform - The View Transform determines the application's viewing direction, orientation, and perspective, and maps coordinate values from world coordinates to virtual device coordinates. The transformation pipeline passes the geometric data assembled into world coordinates through the View Transform into virtual device coordinate space. The View Transform, view clip bounds, and VDC orientation collectively determine the generated image in VDC space.
- XGL maps from Virtual Device Coordinate values to Device Coordinate values automatically using the VDC Transform. The VDC Transform performs this mapping by comparing the VDC and DC ranges. The VDC-to-DC mapping allows much of the pipeline from Model Coordinates to Virtual Device Coordinates to remain device independent. The VDC Transform is not accessible to the application.
-
Figure 1-5 illustrates the 2D viewing pipeline. Figure 1-6 illustrates the 3D viewing pipeline.

Figure 1-5

Figure 1-6
Color
- The XGL color pipeline defines how colors are moved from the application's color type to the hardware device color type. The application's color type is defined with respect to the XGL Raster Device object associated with the Context. If the color type requested by the application is the same as the color type of the underlying hardware, no color conversion is necessary. The color values of the pixels are passed to the hardware without modification.
- If the application color type is different from the hardware color type, a color conversion is required. In this case, the Color Map object is used to define color conversion from one color space to another. The application can perform color conversion in the following cases:
-
- The application can request indexed colors when the underlying hardware is true-color RGB. The indexed-to-RGB conversion is carried out using a color table stored in the XGL Color Map object.
- The application can request RGB colors when the underlying hardware is indexed. The RGB-to-indexed conversion is done using a color cube stored in an XGL Color Map object.
- The Color Map object is an abstraction of a color table that is associated with a Device object. In simple cases with no conversion, the Color Map object is used as the software interface between the application programmer and the device color lookup table. The default color table, initialized at the creation of the Color Map object, is a two-element, black and white color table. When an indexed Window Raster Device object is created, either the default Color Map or an application-created Color Map is attached to the Raster.
Color Map Attributes
- Color Map attributes fall into two categories: attributes used for indexed-to-RGB conversion, and attributes used for RGB-to-indexed conversion.
-
- For indexed-to-RGB conversion, Color Map attributes identify the color table structure, specify the number of entries in the color table, and determine the maximum number of entries the underlying hardware allows in a color table. When the color type is indexed color and vertex shading is required, color ramps must be defined in the color table for the colors used in shading. The application can write its own function to map colors from indexed to RGB color type.
- If an application's Device object color type is RGB and the underlying hardware is indexed, XGL uses a color cube and dithering to convert the application's RGB colors to the display's indexed colors. The color cube is located in the color table associated with an XGL Color Map. A Color Map attribute sets the size of the color cube, which is formatted as an array of three integers specifying the size of the red, green, and blue axes of the color cube.
Lighting and Shading
- The XGL API supports flat shading and Gouraud shading. Light sources are defined as Light objects. A Light object can simulate ambient, directional, positional, and spot lighting, and it defines the illumination calculations that XGL uses for rendering. Lights are also used to compute the color of the vertices of the geometric data of a primitive.
- Light object attributes specify light colors, positions, and directions, and determine the attenuation coefficients of the light. For a spotlight, attributes determine the angle of the beam and the light's attenuation characteristics.
Stroke Fonts
- XGL provides a set of fonts that can be used for rendering text in an associated Context object. Text strings can be composed of characters from a single font or up to four fonts per Context. Text-encoding schemes permit multibyte text encoding and ISO encoding. Multibyte encoding (also known as Extended Unix Coding or EUC) uses control characters and bit patterns to specifiy different character sets within a character string. Allowing different encoding schemes and up to four fonts per Context supports internationalization extensions, allowing switching between different languages (character sets) within a text string. By default, a monospaced roman font is supplied with the Context object.
- Text can be rendered in any orientation in 3D space using the xgl_stroke_text() operator, or it can be rendered parallel to the display surface using the xgl_annotation_text() operator. The appearance of rendered text is determined by Context stroke text and annotation text attributes.
Raster Text
- XGL provides raster text functionality through the XGL Memory Raster object and the XGL raster operators xgl_context_copy_buffer() and xgl_image(). The raster text feature enables applications to render text with bitmap fonts. Applications can generate bitmap fonts through the X window system, or they can use their own bitmap fonts. Raster text can be rendered as stencils or in block format, and is rendered parallel to the display surface.
Line Patterns
- XGL provides a number of predefined line patterns that an application can request through the Context object. In addition, an application can create new line patterns using the Line Pattern object. Line patterns are used to define the pattern of lines, curves, and surface edges.
- The default line style for rendering is a solid line. Context attributes change the line style to a patterned line and define the pattern as one of the predefined line patterns or as the pattern defined by the Line Pattern object. Context attributes also determine the color of the pattern, which can be drawn in a single color or in two alternating colors.
- A new line pattern is specified by defining an array of alternating on and off segment lengths. The segments are used cyclically: when the end of a pattern is reached, the pattern starts over again from the beginning. For surface edges, the pattern wraps cyclically along edges and around corners until the end of the edge is reached.
Geometry Caching
- XGL provides two buffering mechanisms to cache the geometric representation of data. One mechanism, the Pcache object, provides non-editable, non-hierarchical display list functionality for XGL. The Pcache object stores a sequence of primitives and relevant attributes for rendering at one time. Using the Pcache object, application programmers can write XGL code and tune it for the high performance that display lists can provide. The use of Pcache objects optimizes performance for most 3D graphics applications running on graphics adaptors with display list capabilities.
- The second mechanism, the Gcache object, provides a facility to decompose complex primitives and accelerate their rendering through the use of simpler primitives that are suited for a particular graphics device. The Gcache object reduces the complexity of a primitive by allowing XGL to process the primitive into many simple primitives, storing the relevant attribute values. For example, a Gcache could contain the polylines that comprise a string of stroke text, or the triangles that make up a polygon. A Gcache also enables an application to decompose a primitive once and then render the result many times.
NURBS Curves and Surfaces
- XGL includes advanced primitives for non-uniform rational B-spline (NURBS) curves and surfaces. NURBS are effective for representing simple or complex geometric shapes, and include powerful mathematical properties that provide ease of manipulation and use. XGL NURBS curves are general enough for users to generate uniform curves such as Bezier curves or uniform B-splines. NURBS attributes enable the application to control the precision of curve rendering and the smoothness of the curve, and allow the application to balance the requirements of curve appearance and performance. XGL NURBS surfaces can be trimmed to define non-rectangular topologies, and the display of the surfaces can be enhanced with isoparametric curves.
- The display of NURBS curves and surfaces can be improved using Gcache objects. Much of the processing time required for NURBS curve and surface display is absorbed during the creation of the Gcache object. This can substantially speed up rendering of NURBS curves and surfaces.
Texture Mapping
- The XGL library supports 2D texturing of 3D surface primitives using a texturing raster image specified by the MipMap Texture object through the Texture Map object. Textures are defined in a normalized texture space (u,v), with the u and v coordinates defined in the range 0.0 to 1.0.
- Mapping of the texture onto a polygon is accomplished by deriving (u,v) values from the vertex, normal, or data fields of the polygon vertices. For example, if a texture image is mapped completely onto a four-sided polygon (in a simple manner with no wrapping), the lower vertex of the polygon would be represented by the (u,v) coordinate pair (0.0,0.0), the upper left vertex by (0.0,1.0), the upper right by (1.0,1.0), and the lower right by (1.0,0.0).
- The result of the texturing operation can be applied to different stages of the rendering pipeline. XGL supports sampling methods such as point, bilinear, and trilinear to obtain texture values and supports several color composition techniques, such as blend, decal, and modulate.
-
Note - At this release, the Texture Map object should be used for texture mapping. The Data Map Texture object is retained for backward compatibility, but it will be removed from the XGL library at a future release.
|
|