HP c8000 User's Guide

OpenGL Implementation Guide
for HP-UX 11.x
Manufacturing Part Number : B2355-IE002
Edition E0206
© Copyright 2005-2006 by Hewlett-Packard
Legal Notices
Hewlett-Packard assumes no responsibility for the use or reliability of its software on equipment that is not furnished by Hewlett-Packard.
This document contains proprietary information that is protected by copyright. All rights reserved. No part of this document may be photocopied, reproduced or translated to another language without the prior written consent of Hewlett-Packard Company.
Restricted Rights Legend
Use, duplication, or disclosure by the U.S. Government Department of Defense is subject to restrictions as set forth in paragraph (b)(3)(ii) of the Rights in Technical Data and Software clause in DFARS
252.227.7013. This document contains proprietary information that is protected by
copyright. All rights are reserved. No part of this document may be photocopied, reproduced or translated to another language without the prior written consent of Hewlett-Packard Company.
UNIX is a registered trademark in the United States of America and other countries, licensed exclusively through X/Open Company Limited.
This software and documentation is based in part on the F ourth Berkeley Software Distribution under license from the Regents of the University of California.
© Copyright 2005-2006 Hewlett-Packard Company. All Rights Reserved. © Copyright 1980, 1984 AT&T, Inc. © Copyright 1979, 1980, 1983 The Regents of the University of
California.
2
1. overview of OpenGL
introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
the OpenGL product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
hp’s implementation of OpenGL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
hp’s implementation of the OpenGL libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
supported graphics devices. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
supported operating systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
supported visuals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
visual support for other graphics devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
buffer sharing between multiple processes and threads. . . . . . . . . . . . . . . . . . . . . 11
SIGCHLD and the GRM daemon. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
threads support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
threads support in November, 1999 11. ACE release. . . . . . . . . . . . . . . . . . . . . 12
multiple graphics threads support in June, 2000 11. ACE OpenGL. . . . . . . . . 13
additional documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
64-bit programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
using libGL in 64-bit together with the +compat linker option. . . . . . . . . . . . . 14
SLS support. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
the standard OpenGL product. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
the OpenGL Utilities Library (GLU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
input and output routines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
the OpenGL extensions for the X Window system (GLX). . . . . . . . . . . . . . . . . . . . 15
mixing of OpenGL and Xlib. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Gamma correction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
OpenGL extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
visibility test extensions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
occlusion extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
occlusion culling code fragments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
GL_HP_supersample extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
rendering details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
default visuals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
EXP and EXP2 fogging. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
bow-tie quadrilaterals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
decomposition of concave quadrilaterals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
vertices outside of a begin/end pair . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
index mode dithering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
environment variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

Contents

1
Contents
new environment variables as of release 1.05. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2. installation and setup
verification instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
is your system software preloaded with instant ignition? . . . . . . . . . . . . . . . . . . . . . 29
verify that OpenGL is on your workstation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
installing OpenGL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
1. install OpenGL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2. check log file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3. verify the product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
the OpenGL file structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3. running OpenGL programs
virtual GLX (VGL) mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
visual support for the VGL mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
special considerations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
running hp's implementation of the OpenGL stereo application . . . . . . . . . . . . . . . . . 40
4. compiling and linking programs
overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
including header files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
linking shared libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
compiling 32-bit and 64-bit applications for OpenGL . . . . . . . . . . . . . . . . . . . . . . . . . . 47
OpenGL procedure calls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
2
5. programming hints
OpenGL correctness hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4D values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
texture coordinates. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
OpenGL performance hints. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
display list performance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
geometric primitives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
GL_COMPILE_AND_EXECUTE mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
draw array set extensions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
benefits of glDrawArraySethp: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
using glDrawArraySethp: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
textures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
state changes and their effects on display lists. . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
regular primitive data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
texture downloading performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
selection performance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
state change . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
optimization of lighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
occlusion culling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
high frame rate applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
rescaling normals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Contents
3
Contents
4
1 overview of OpenGL
OpenGL is a hardware-independent Application Programming Interface (API) that provides an interface to graphics operations. HP’s implementation of OpenGL converts API commands to graphical images via hardware and/or software functionality.
Chapter 1 5

overview of OpenGL

introduction
introduction
The OpenGL interface consists of a set of commands that allow applications to define and manipulate three-dimensional objects. The commands include:
Geometric primitive definitions
Viewing operations
Lighting specifications
•Primitive attributes
Pipeline control
Rasterization control OpenGL has been implemented on a large number of vendor platforms
where the graphics hardware supports a wide range of capabilities (for example, frame buffer only devices, fully accelerated devices, devices without frame buffer, etc.).
For more information on OpenGL, refer to these documents , published by Addison-Wesley and shipped with HP’s implementation of OpenGL:
OpenGL Programming Guide Instruction on programming in OpenGL, offered in a tutorial format.
OpenGL Reference Manual A reference that contains details on all standard OpenGL functions, as well as utility (GLU) functions and X-windows (GLX) functions.
OpenGL Programming for the X Window System Instructions on interfacing OpenGL with the X Window system.
Chapter 16
overview of OpenGL
the OpenGL product
the OpenGL product
This section provides information about HP’s implementation of the OpenGL product, as well as information about the standard OpenGL product.
hp’s implementation of OpenGL
Topics covered in this section are:
HP’s implementation of the OpenGL libraries
Supported graphics devices
Supported visuals
Visual support for other graphics devices
Buffer sharing between multiple processes
hp’s implementation of the OpenGL libraries
The OpenGL product does not support archived libraries. HP’s implementation of OpenGL provides the following libraries:
libGL.sl OpenGL shared library
libGLU.sl OpenGL utilities library
There are two sets of libraries, one for 32-bit and one for 64-bit. The 32-bit path is:
/opt/graphics/OpenGL/lib
The 64-bit libraries are in a subdirectory:
/opt/graphics/OpenGL/lib/pa20_64
The following graphic depicts the organization of these libraries, which follows the HP-UX standard for 64-bit libraries.
Chapter 1 7
overview of OpenGL
the OpenGL product
The arrows in the graphic represent symbolic links.
/opt/graphics/OpenGL/lib
libGL.1 libGL.2
In the library directory, you will see various versions. For example:
libGL.1 is a 10.20 compatible library for applications which were built on 10.20.
libGL.2 is the library which is for applications built on 11.x (this is why libGL.sl is a symbolic link to libGL.2).
There is only one set of libraries in 11.x for 64-bit. These libraries are version number 2.
The other libraries you will see in these directories are all drivers for specific graphics devices. Device drivers, which have names of the form libdd* are loaded automatically at execution time, contingent upon device type. The user program does not specifically link in a device driver.
supported graphics devices
These are the graphics devices that support OpenGL:
libGL.s1
pa20_64
libGL.2 libGL.s1
HP Visualize fxe
HP Visualize fx-5
HP Visualize fx-10
•HP Fire GL-UX
•ATI FireGL X1
•ATI FireGL T2
•ATI FireGL X3
supported operating systems
OpenGL is supported on PA-RISC 2.0 systems running the 64-bit version of HP-UX 11.0 and 11i v1 (11.11).
Chapter 18
overview of OpenGL
the OpenGL product
supported visuals
In this section, each visual table will have a graphics device associated with it. For information on visual support for graphics devices not in the above list, read the subsequent section “Visual Support for Other
Graphics Devices.”
Table 1-1 Visual Table for HP Visualize fxe
X Visual Information OpenGL GLX Information
Class Depth
PseudoColor 8 256 8 1 0 0 0 0 0 0 0 0 0 0 0 0 0 PseudoColor 8 256 8 0 0 0 0 0 0 0 0 24 4 0 0 0 0 PseudoColor 8 256 8 0 0 1 0 0 0 0 0 24 4 0 0 0 0 TrueColor 24 256 24 0 1 0 0 8 8 8 0 24 4 16 16 16 0 TrueColor 24 256 24 0 1 1 0 8 8 8 0 24 4 16 16 16 0
Color Map Size
Buffer Size
Overlay=1 or Image=0
RGBA=1 or Index=0
Double Buffer
# Aux. Buffers
Color Buffer Stencil
RGBAZ RGB A
Accumulation Buffer
Table 1-2 Visual Table for HP Visualize fx-5 / fx-10
X Visual Information OpenGL GLX Information
Class Depth
PseudoColor 8 256 8 1 0 0 0 0 0 0 0 0 0 0 0 0 0 PseudoColor 8 256 8 0 0 0 0 0 0 0 0 24 4 0 0 0 0 PseudoColor 8 256 8 0 0 1 0 0 0 0 0 24 4 0 0 0 0 TrueColor 24 256 24 0 1 0 0 8 8 8 8 24 4 16 16 16 16 TrueColor 24 256 24 0 1 1 0 8 8 8 8 24 4 16 16 16 16
TrueColor 24 256 24 0 1 0 0 8 8 8 8 24 4 16 16 16 0 TrueColor 24 256 24 0 1 1 0 8 8 8 8 24 4 16 16 16 0
Color Map Size
Buffer Size
Overlay=1 or Image=0
RGBA=1 or Index=0
Double Buffer
# Aux. Buffers
Color Buffer Stencil
RGBAZ RGB A
Accumulation Buffer
Table 1-3 Visual Table for HP Fire GL-UX
X Visual Information OpenGL GLX Information
Class Depth
PseudoColor 8 256 8 1 0 0 0 0 0 0 0 0 0 0 0 0 0 PseudoColor 8 256 8 1 0 1 0 0 0 0 0 0 0 0 0 0 0 TrueColor 24 256 24 0 1 0 0 8 8 8 0 24 4 16 16 16 0 TrueColor 24 256 24 0 1 1 0 8 8 8 0 24 4 16 16 16 0
Color Map Size
Buffer Size
Overlay=1 or Image=0
RGBA=1 or Index=0
Double Buffer
# Aux. Buffers
Color Buffer Stencil
RGBAZ RGB A
Accumulation Buffer
Chapter 1 9
overview of OpenGL
the OpenGL product
Table 1-3 Visual Table for HP Fire GL-UX (Continued)
X Visual Information OpenGL GLX Information
Class Depth
TrueColor 24 256 32 0 1 0 0 8 8 8 8 24 4 16 16 16 16 TrueColor 24 256 32 0 1 1 0 8 8 8 8 24 4 16 16 16 16
Color Map Size
Buffer Size
Overlay=1 or Image=0
RGBA=1 or Index=0
Double Buffer
# Aux. Buffers
Color Buffer Stencil
RGBAZ RGB A
Accumulation Buffer
Table 1-4 Visual Table for ATI Fire GL T2/X1/X3
X Visual Information OpenGL GLX Information
Class Depth
PseudoColor 8 256 8 1 0 0 0 0 0 0 0 0 0 0 0 0 0 PseudoColor 8 256 8 1 0 1 0 0 0 0 0 0 0 0 0 0 0 TrueColor 24 256 32 0 1 0 0 8 8 8 8 24 8 16 16 16 16 TrueColor 24 256 32 0 1 1 0 8 8 8 8 24 8 16 16 16 16
Color Map Size
Buffer Size
Overlay=1 or Image=0
RGBA=1 or Index=0
Double Buffer
# Aux. Buffers
Color Buffer Stencil
RGBAZ RGB A
Accumulation Buffer
stereo visual support for Visualize fx-5, fx-10, and Fire GL-UX
When a monitor is configured in a stereo capable mode, HP Visualize fx-5, fx-10 and Fire GL-UX will have the following additional stereo visuals available. For more information on OpenGL stereo, read the section “Running HP’s Implementation of the OpenGL Stereo
Application,” found in Chapter 3 of this document.
Table 1-5 Stereo Visual Support for HP Visualize fx-5 and fx-10
X Visual Information OpenGL GLX Information
Class Depth
PseudoColor 8 255 8 0 0 TrueColor 24 256 24 0 1
TrueColor 24 256 24 0 1
a. Depth- and stencil buffers are only allocated for image-plane visuals.
Color Map Size
Buffer Size
Overlay= 1 or Image=0
RGBA= 1 or Index= 0
Double Buffer
a a
a
# Aux.
Stereo
Buffers
10 0000244 0000 10 8880244 1616160
10 8888244 16161616
Color Buffer Stencil
RGBAZ RG B A
Accumulation Buffer
Chapter 110
overview of OpenGL
the OpenGL product
Table 1-6 Stereo Visual Support for HP Fire GL-UX
X Visual Information OpenGL GLX Information
Class Depth
TrueColor 24 256 24 0 1 1 1 0 8 8 8 0 24 4 16 16 16 0 TrueColor 24 256 32 0 1 1 1 0 8 8 8 8 24 4 16 16 16 16
Color Map Size
Buffer Size
Overlay =1 or Image=0
RGBA= 1 or Index=0
Double Buffer
Stereo
# Aux. Buffers
Color Buffer Stencil
RGBAZ R G B A
Accumulation Buffer
Table 1-7 Stereo Mode Visual Support for ATI Fire X1/X3
X Visual Information OpenGL GLX Information
Class Depth
PseudoColor 8 256 8 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 PseudoColor 8 256 8 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 TrueColor 24 256 32 0 1 0 0 0 8 8 8 8 24 8 16 16 16 16 TrueColor 24 256 32 0 1 0 1 0 8 8 8 8 24 8 16 16 16 16
TrueColor 24 256 32 0 1 1 TrueColor 24 256 32 0 1
Color Map Size
Buffer Size
Overlay=1 or Image=0
RGBA=1 or Index=0
Double Buffer
110
# Aux.
Stereo
Buffers
00
Color Buffer Stencil
RGBAZ RGB A
888824 888824
8 8
Accumulation Buffer
16 16 16 16 16 16 16 16
visual support for other graphics devices
The OpenGL product can be used with devices that have no hardware OpenGL support using the Virtual Memory Driver (VMD) in Virtual GLX mode (VGL). In addition, VMD allows you to use many X11 drawables (local or remote) as “virtual devices” for three-dimensional graphics with OpenGL. This includes rendering to X terminals and other non-GLX extended X servers.
Table 1-8 Visuals Table for VMD
X Visual Information OpenGL GLX Information
Class Depth
PseudoColor 8 256 8 0 0 PseudoColor 8 256 8 0 0
TrueColor 24 256 24 0 1 DirectColor 24 256 24 0 1
Color Map Size
Buffer Size
Overlay=1 or Image=0
RGBA=1 or Index=0
Double Buffer
b b
b
b
# Aux. Buffers
0 0000244 0 0 0 0 0 000000 0 0 0 0
0888c24 4 16 16 16 16 0888c24 4 16 16 16 16
Color Buffer Stencil
RGBA
a
Z
Accumulation Buffer
RGBA
Chapter 1 11
overview of OpenGL
the OpenGL product
a. Depth- and stencil buffers are only allocated for image-plane visuals. b. Double buffering is set to True (1) if the X visual supports the X double-buffering extension (DBE).
c. Alpha will only work correctly on 12- and 24-bit TrueColor and DirectColor visuals when the X server does not use
the high-order nibble/byte in the X visual. Also, note that when alpha is present, Buffer Size will be 16 for the 12-bit visuals and 32 for the 24-bit visuals.
buffer sharing between multiple processes and threads
In the OpenGL implementation, all drawable buffers that are allocated in virtual memory are not sharable among multiple processes. As an example, on a HP Visualize fx-5 configuration, the accumulation buffer for a drawable resides in virtual memory (VM) and therefore, each OpenGL process rendering to the same drawable through a direct rendering context, will have its own separate copy of the accumulation buffer. For more information on hardware and software buffer configurations for OpenGL devices, see Tables 1-1 through 1-8 in the Supported Visuals section of this chapter.
True buffer sharing between multiple processes can be accomplished by utilizing indirect rendering contexts. In this case, rendering on behalf of all GLX clients is performed by the X server OpenGL daemon process, and there is only one set of virtual memory buffers per drawable.
Within a single process, multiple threads will share virtual memory buffers (both rendering and accumulation buffers) by default. GLX-compliant concurrent rendering into these buffers is supported. It is the responsibility of the application to synchronize buffer access or partition the rendering buffer amongst individual threads, if desired.
SIGCHLD and the GRM daemon
The Graphics Resource Manager daemon (grmd) is started when the X11 server is started. In normal operation, an OpenGL application will not start the daemon, and as a result grmd will not be affected by the SIGCHLD manipulation that occurs as part of that start-up. However, if grmd dies for some reason, the graphics libraries will restart grmd whenever they need shared memory. An example of where this can occur is during calls to glXCreateContext or glXMakeCurrent.
threads support threads support in November, 1999 11. ACE release Starting with the
HP-UX 11.0 Additional Core Enhancements (ACE) (November, 1999)
release, HP OpenGL will support Level 1b threads. This means HP OpenGL can be used in a threaded application, but OpenGL graphics
Chapter 112
overview of OpenGL
the OpenGL product
calls must be restricted to a single thread, which remains the same thread for the duration of the process. This is not the same as OpenGL calls being made in one thread at a time. Other threads can be used for computations, etc.
Using OpenGL graphics in a Kernel threaded application requires that the application link with libpthread.sl (not the archived version, libpthread.a).
OpenGL libraries are not cancel safe or fork safe. A context can only be made current in the dedicated graphics thread.
multiple graphics threads support in June, 2000 11. ACE OpenGL Starting with the June, 2000 11.ACE OpenGL release, OpenGL will Support Level 2 threads. This means HP OpenGL can be used in threaded applications, and more than one thread can use OpenGL.
Using OpenGL graphics in a Kernel threaded application requires that the application link with libpthread.sl (not the archived version, libpthread.a).
OpenGL libraries are not cancel safe or fork safe. A given context can only be current in one thread at a time.
additional documentation For more information on using threads , see the following documentation:
•The devresource.hp.com web site (search for “Threads and Multiprocessing” )
The OpenGL Programming Guide
The OpenGL Reference Manual
Threadtime by S. Norton and M. Dipasquale
64-bit programming
Starting with the HP-UX 11.0 Additional Core Enhancements (ACE) (November, 1999) release, HP OpenGL will support 64-bit programming. Applications using 64-bit computing are supported on SPUs with 64-bit capabilities only; they are not supported on 32-bit SPUs.
For information on porting your application to take advantage of 64-bit capabilities, see the devresource.hp.com web site. Search for “64-bit Computing.”
Chapter 1 13
overview of OpenGL
the OpenGL product
64-bit OpenGL allows “large data space” because the pointers are now 64-bit. But, the OpenGL data types themselves are the same as the 32-bit library. For example, GLint is a 32-bit integer, not a 64-bit long.
All 64-bit OpenGL libraries are located in /opt/graphics/OpenGL/lib/pa20_64. The following sample compile and link lines may help you to build your application once it has been ported to take advantage of 64-bit capabilities:
Sample 32-bit compile and link:
cc -g -Aa -D_HPUX_SOURCE -z -I/opt/graphics/OpenGL/include\
-I/usr/include/X11R6 -o cube.32 cube.c
-L/opt/graphics/OpenGL/lib\
-L/usr/lib/X11R6 -ldld -lGLU -lGL -lXHP11 -lXext -lX11 -lm
Sample 64-bit compile and link (for 11.x only):
cc -g -Aa +DA2.0W -D_HPUX_SOURCE -z
-I/opt/graphics/OpenGL/include -I/usr/include/X11R6 -o cube.64
cube.c -L/opt/graphics/OpenGL/lib/pa20_64
-L/usr/lib/X11R6/pa20_64 -L/usr/lib/pa20_64 -L/usr/lib -ldld\
-lGLU -lGL -lXHP11 -lXext -lX11 -lm
using libGL in 64-bit together with the +compat linker option Because of a limitation in the 64-bit linker, if the +compat linker option is used,
-lc must appear in the link order before -lGL. Otherwise, a segmentation
violation will occur when running the linked program. The following partial compile line shows the relevant order:
cc +DA2.OW prog.c -Wl,+compat
-L/opt/graphics/OpenGL/lib/pa20_64 -lc -lGL
When not using -Wl,+compat, the link order should have -lGL before -lc. By default, cc implicitly links in -lc as the last library in a link. Without Wl,+compat, a partial compile line is:
cc +DA2.OW prog.c -L/opt/graphics/OpenGL/lib/pa20_64 -lGL -lc
or
cc +DA2.OW prog.c -L/opt/graphics/OpenGL/lib/pa20_64 -lGL
SLS support
When the display is in a multi-display configuration using the XServer Single Logical Screen (SLS) extension, OpenGL can and will render to windows on or spanning any of the SLS displays. This rendering is done
Chapter 114
overview of OpenGL
the OpenGL product
at some loss of performance. For full single display performance, define the HPOGL_SLS_LOCK_WINDOW environment variable before executing the program. The define value should be the display number where the window will reside. When the window is on this display, full performance can be had; when it is on other displays, the window will be blank. For more information see the XServer documentation of SLS.
the standard OpenGL product
This section covers the following topics:
The OpenGL Utilities Library (GLU)
Input and Output Routines
The OpenGL Extensions for the X Window System (GLX)
the OpenGL Utilities Library (GLU)
The OpenGL Utilities Library (GLU) provides a useful set of drawing routines that perform such tasks as:
Generating texture coordinates
Transforming coordinates
Tessellating polygons
Rendering surfaces
Providing descriptions of curves and surfaces (NURBS)
Handling errors
For a detailed description of these routines , refer to the Reference section or the OpenGL Reference Manual.
input and output routines
OpenGL was designed to be independent of operating systems and window systems, therefore, it does not have commands that perform such tasks as reading events from a keyboard or mouse, or opening windows. To obtain these capabilities, you will need to use X Windows routines (those whose names start with “glX”).
the OpenGL extensions for the X Window system (GLX)
The OpenGL Extensions to the X Window System (GLX) provide routines for:
Choosing a visual
Managing the OpenGL rendering context
Chapter 1 15
overview of OpenGL
the OpenGL product
Off-screen rendering
Double-buffering
Using X fonts
For a detailed description of these routines , refer to the Reference section or the OpenGL Reference Manual.
Chapter 116
overview of OpenGL
mixing of OpenGL and Xlib
mixing of OpenGL and Xlib
The OpenGL implementation conforms to the specification definition for mixing of Xlib and OpenGL rendering to the same drawable. The following points should be considered when mixing Xlib and OpenGL:
OpenGL and Xlib renderers are implemented through separate pipelines and control streams, thus, rendering synchronization must be performed as necessary by the user’s application via the GLX glXWaitX() and glXWaitGL() function calls.
Xlib rendering does not affect the Z-buffer, so rendering in X and then OpenGL would result in the OpenGL rendering replacing the Xlib rendering. This is true if the last OpenGL rendering to the Z-buffer at that location resulted in the depth test passing.
Note that mixing Xlib rendering with OpenGL rendering as well as with VMD, when using alpha buffers, can produce unexpected side effects and should be avoided.
Chapter 1 17
Loading...
+ 43 hidden pages