Download  Print this page

HP b2600 Supplementary Manual

Opengl implementation guide
Hide thumbs


OpenGL Implementation Guide
for HP-UX 11.x
Manufacturing Part Number : B2355-IE002
Edition E0206
© Copyright 2005-2006 by Hewlett-Packard


Table of Contents

  Also See for HP b2600

  Related Manuals for HP b2600

  Summary of Contents for HP b2600

  • Page 1 OpenGL Implementation Guide for HP-UX 11.x Manufacturing Part Number : B2355-IE002 Edition E0206 © Copyright 2005-2006 by Hewlett-Packard...
  • Page 2: Legal Notices

    Legal Notices The information contained in this document is subject to change without notice. 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.
  • Page 3: Table Of Contents

    OpenGL ......... . 7 hp’s implementation of the OpenGL libraries ......7 supported graphics devices .
  • Page 4 ..........38 running hp's implementation of the OpenGL stereo application ....40 4.
  • Page 5 5. programming hints OpenGL correctness hints ..........51 4D values .
  • Page 6 Contents...
  • Page 7: Overview Of Opengl

    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...
  • Page 8: Introduction

    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.
  • Page 9: The Opengl Product

    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 •...
  • Page 10: Supported Graphics Devices

    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). /opt/graphics/OpenGL/lib libGL.s1 libGL.2 pa20_64 libGL.2 libGL.s1 Chapter 1...
  • Page 11: Supported Visuals

    Buffer Class Depth Size Size PseudoColor 8 PseudoColor 8 PseudoColor 8 TrueColor TrueColor Table 1-2 Visual Table for HP Visualize fx-5 / fx-10 X Visual Information OpenGL GLX Information Color Buffer Class Depth Size Size PseudoColor 8 PseudoColor 8 PseudoColor 8...
  • Page 12 TrueColor 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...
  • Page 13: Visual Support For Other Graphics Devices

    Table 1-6 Stereo Visual Support for HP Fire GL-UX X Visual Information OpenGL GLX Information Color Buffer Class Depth Size Size TrueColor TrueColor Table 1-7 Stereo Mode Visual Support for ATI Fire X1/X3 X Visual Information OpenGL GLX Information Color...
  • Page 14: Buffer Sharing Between Multiple Processes And Threads

    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...
  • Page 15: Multiple Graphics Threads Support In June, 2000 11. Ace Opengl

    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.
  • Page 16: Using Libgl In 64-Bit Together With The +Compat Linker Option

    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.
  • Page 17: The Standard 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;...
  • Page 18 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 1...
  • Page 19: 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.
  • Page 20: Gamma Correction

    overview of OpenGL Gamma correction Gamma correction Gamma correction is used to alter hardware colormaps to compensate for the non-linearities in the phosphor brightness of monitors. Gamma correction can be used to improve the “ropy” or modulated appearance of antialiased lines. Gamma correction is also used to improve the appearance of shaded graphics images, as well as scanned photographic images that have not already been gamma corrected.
  • Page 21: Opengl Extensions

    OpenGL Programming for the X Window System. visibility test extensions HP supports extensions for visibility testing and occlusion culling. See the on-line Reference Manual for information on HP’s visibility test extensions, glVisibilityBufferHP and glNextVisibilityTestHP. occlusion extension This occlusion culling extension defines a mechanism whereby an application can determine the non-visibility of some set of geometry based on whether an encompassing set of geometry is non-visible.
  • Page 22 overview of OpenGL OpenGL extensions if (result) { glColorMask(GL_TRUE, GL_TRUE, GL_TRUE); glDepthMask(GL_TRUE); renderPart(i); glDepthMask(GL_FALSE); glColorMask (GL_FALSE, GL_FALSE, GL_FALSE); /* Disable Occlusion Culling test */ glDisable(GL_OCCLUSION_TEST_HP); /* Turn on writes to depth and color buffers */ glColorMask(GL_TRUE, GL_TRUE, GL_TRUE); glDepthMask(GL_TRUE); The key idea behind occlusion culling is that the bounding box is much simpler (i.e., fewer vertices) than the part itself.
  • Page 23: Gl_Hp_Supersample Extension

    overview of OpenGL OpenGL extensions GL_HP_supersample extension This supersample extension defines a mechanism for enabling and disabling a full scene anti-aliasing method. It is supported on Visualize fx-10b, FireGL-UX and FireGL T2/X1/X3 graphics hardware. On the FireGL hardware the X Server must be configured to enable this capability in order for the extension to be present.
  • Page 24: Rendering Details

    HP treats the two parts of the bow tie as two separate triangles that have attributes assigned to their vertices. This special rendering process takes care of the color problem at the non-existent fifth vertex.
  • Page 25: Decomposition Of Concave Quadrilaterals

    HP determines whether the concave quadrilateral will become front-facing or back-facing prior to dividing the quadrilateral into triangles. HP then divides the surface into two triangles between vertices zero and two or one and three depending on the vertex causing concavity.
  • Page 26: Environment Variables

    HPOGL_ALLOW_LOCAL_INDIRECT_CONTEXTS This variable may be set if a need arises to really create a local indirect context. By default, if an indirect context is requested for a local HP display connection, a direct context will be created instead because the performance will be much better.
  • Page 27: New Environment Variables As Of Release 1.05

    The initial value is set to 10241024 bytes. This variable should be set to the byte size desired for shared memory usage. This option is available only for the HP Visualize fx family of graphics devices.
  • Page 28 overview of OpenGL environment variables Additionally, an application can programmatically switch between the slower and faster double buffering methods using the following new glHint calls: glHint(GL_BUFFER_SWAP_MODE_HINT_HP, GL_FASTEST); Switches to the faster double buffering method. glHint(GL_BUFFER_SWAP_MODE_HINT_HP, GL_NICEST); Switches to the slower double buffering method. Note that setting either HPOGL_DSM_ENABLE_FAST_BUFFER_SWAP or HPOGL_DSM_DISABLE_FAST_BUFFER_SWAP in the application...
  • Page 29: Installation And Setup

    For HP-UX 11.X, the box containing the “HP-UX 11.0 Install and Core OS” CD-ROM will also hold a second CD-ROM entitled “HP-UX 11.0 Core Operating Systems Options.” The OpenGL run-time and developer’s Chapter 2...
  • Page 30 HP-UX 11.0 Core Operating Systems Options CD-ROM in the “Graphics and Technical Computing Software” bundle (B6268AA). Chapter 2...
  • Page 31: Verification Instructions

    /usr/sbin/swlist -l product This will give you a list of all of the products on the system, and in that product list you will see lines similar to the following if HP OpenGL has been installed on your system. OpenGLDevKit...
  • Page 32: Installing Opengl

    3. Verify the product. Each step is described on the subsequent sections. 1. install OpenGL For 11.00 and 11.11, OpenGL is bundled with the HP-UX Core Operating Systems Option CD-ROM in the “Graphics and Technical Computing Software” bundle B6268AA. If your system is Instantly Ignited, your OpenGL product is already installed.
  • Page 33 Table 2-1 OpenGL Development Environment Filesets for 11.0 and 11.11 OpenGLDevKit Fileset OPENGL-CONTRIB OPENGL-PRG OPENGL-WEBDOC OPENGL-64-CONTRB OPENGL-64-EXPL Table 2-2 OpenGL Runtime Environment Filesets for 11.0 and 11.11 OpenGLRuntime Fileset OPENGL-DEMO OPENGL-RUN OPENGL-SHLIBS OPENGL-64-DEMO OPENGL-64-RUN OPENGL-64-SHLB Chapter 2 installation and setup Contains Contributed or unsupported program files Files necessary for the OpenGL programming...
  • Page 34 installation and setup installing OpenGL 2. check log file Once you have completed the installation process, look at the contents of the file /var/adm/sw/swinstall.log. This file lists the filesets loaded, the customize scripts that ran during the installation process, and informative messages.
  • Page 35: Verify The Product

    3. verify the product Here are three methods for determining if you have correctly installed OpenGL on your system. • Run the program If OpenGL has been correctly installed on your system, running verify_install will cause a window containing a 3D rendering of the text “OpenGL”...
  • Page 36: The Opengl File Structure

    OpenGL file structure. /opt/graphics/OpenGL/contrib/libwidget /opt/graphics/OpenGL/include/GL /opt/graphics/OpenGL/contrib/glut_samples /opt/graphics/OpenGL/contrib/libglut /opt/graphics/OpenGL/lib /usr/lib/X11/Xserver/brokers/extensions/Glx.1 /usr/lib/X11/Xserver/modules/extensions/HP/glx.1 The location of the run-time shared libraries is: /opt/graphics/openGL/lib This directory contains a Motif widget library and source code. This directory contains header files needed for OpenGL development. This directory contains example OpenGL programs that are referenced in the OpenGL Programming Guide, Second Edition published by Addison-Wesley.
  • Page 37 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. 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...
  • Page 38 installation and setup the OpenGL file structure Chapter 2...
  • Page 39: Running Opengl Programs

    running OpenGL programs This chapter gives a description of the Virtual GLX mode, Virtual Memory Driver (VMD), and support of threaded applications. Chapter 3...
  • Page 40: Virtual Glx (Vgl) Mode

    GLX (VGL) mode Virtual GLX (VGL) defines a special transparent mode within hp's implementation of OpenGL that allows an hp client to render through OpenGL to X servers and/or X terminals that do not support OpenGL or the X server extension for GLX.
  • Page 41 VGL mode. The return value is "True" if dpy is VGL; otherwise, the value returned is "False." This is an hp function that is not available on other implementations of OpenGL.
  • Page 42: Running Hp's Implementation Of The Opengl Stereo Application

    OpenGL stereo application running hp's implementation of the OpenGL stereo application Following are the steps required to run hp's implementation of OpenGL "stereo in a window" mode: 1. Find out if your monitor is currently configured in a mode that supports stereo.
  • Page 43 OpenGL programs running hp's implementation of the OpenGL stereo application After successfully re-configuring your monitor, the X Server will be restarted. If you are configuring a Visualize fx display proceed to you can verify the availability of GLX stereo visuals now by running the xglinfo command again.
  • Page 44 OpenGL programs running hp's implementation of the OpenGL stereo application Chapter 3...
  • Page 45: Compiling And Linking Programs

    compiling and linking programs This chapter provides information for including header files in your program, linking shared libraries, compiling 32-bit and 64-bit applications for OpenGL and OpenGL procedure calls. Chapter 4...
  • Page 46: Overview

    compiling and linking programs overview overview Table 4-1 contains a list of the subdirectories in the directory /opt/graphics/OpenGL These subdirectories contain header files and libraries which may be used when compiling and linking your programs. Table 4-1 Subdirectory include/GL lib/pa20_64 lbin contrib/libwidget contrib/libglut...
  • Page 47: Including Header Files

    including header files Most OpenGL programs and applications that only use the standard OpenGL data types, definitions, and function declarations, need only include the header file gl.h under the /opt/graphics/OpenGL/include/GL directory. Use the following syntax: #include <GL/gl.h> Still other header files may be needed by your program, depending on your application.
  • Page 48: Linking Shared Libraries

    To compile your application using ANSI C, you can also use the cc command with either of the command line options +Aa or +Ae. If you are going to compile your application using HP’s ANSI C++ compiler, use the aCC compiler.
  • Page 49: Compiling 32-Bit And 64-Bit Applications For Opengl

    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_<ABBR>hp</ABBR>UX_SOURCE -z \ -I/opt/graphics/OpenGL/include \ -I/usr/include/X11R6 -o cube.32 cube.c \ -L/opt/graphics/OpenGL/lib \...
  • Page 50: Opengl Procedure Calls

    Undefined pragma ìhp_PLT_CALLî ignored) when compiling an OpenGL application, you are most likely using a compiler that does not support this calling convention. To get an appropriate HP C or C++ compiler, you will need to contact your local HP Sales Representative.
  • Page 51: Programming Hints

    The topics covered in this chapter are intended to give you some helpful programming hints as you begin to develop your OpenGL applications. Note that these hints are specific to hp’s implementation of OpenGL. For further information on OpenGL programming hints that are not hp...
  • Page 52 programming hints specific, see Appendix G in the OpenGL Programming Guide and section 6.6 “Maximizing OpenGL Performance” in the OpenGL Programming for the X Window System manual. The programming hints in this chapter are covered in these sections: • OpenGL Correctness Hints •...
  • Page 53: Opengl Correctness Hints

    (0.0, 0.0, 5e10, 1.5e38), instead use the equivalent normalized position (0.0, 0.0, 3.33e-28, 1.0). On HP Visualize fx devices only, if a light position must be specified with a w value that is near the floating point limits, consider setting HPOGL_LIGHTING_SPACE=EC to ensure that lighting occurs in Eye Space.
  • Page 54: Opengl Performance Hints

    OpenGL performance hints OpenGL performance hints Hints provided in this section are intended to help improve your applications performance when using HP’s implementation of OpenGL. display list performance The topics covered here are areas where you can gain substantial improvements in program performance when using OpenGL display lists.
  • Page 55: Draw Array Set Extensions

    programming hints OpenGL performance hints draw array set extensions glDrawArraySethp is a Hewlett-Packard OpenGL 1.1 extension to vertex arrays which provides a high-speed mechanism for rendering multiple primitives. Use of glDrawArraySethp will be easy for applications which currently store geometry in vertex arrays and use multiple calls to glDrawArrays for rendering primitives from the arrays.
  • Page 56: Textures

    When glDrawArraySethp is called, it iterates over count + 1 vertex array indices from list. For 0 HP uses list[i+1] - list[i] sequential elements from each enabled array to construct a sequence of geometric primitives, beginning with element list[i].
  • Page 57: Regular Primitive Data

    ... many more vertices... glEnd(); than this: glBegin(GL_TRIANGLES); glColor3f(1,2,3); glVertex3f(...); ... many more vertices... glEnd(); For performance efficiency avoid glMaterial state changes, especially within a glBegin/glEnd pair. regular primitive data If the vertex data that you give to a display list is regular (that is, every vertex has the same data associated with it), it is possible for the display list to optimize the primitive much more effectively than if the data is not regular.
  • Page 58: Texture Downloading Performance

    programming hints OpenGL performance hints glNormal3fv(&v2); glVertex3fv(&p5); glNormal3fv(&v2); glVertex3fv(&p6); glEnd(); The reason this is faster is the display list can optimize this type of primitive into a single, very efficient structure. The small cost of adding extra data is offset by this optimization. Performance is increased by maximizing the number of vertices per Begin/End pair.
  • Page 59: State Change

    state change OpenGL state setting commands can be classified into two different categories. The first category is vertex-data commands. These are the calls that can occur between a glBegin/glEnd pair: glVertex glColor glIndex glNormal glEdgeFlag glMaterial glTexCoord The processing of these calls is very fast. Restructuring a program to eliminate some vertex data commands will not significantly improve performance.
  • Page 60: Optimization Of Lighting

    GL_LINE, and wide lines. optimization of lighting HP’s implementation of OpenGL optimizes the lighting case such that the performance degradation from one light to two or more lights is linear. Lighting performance does not degrade noticeably when you enable a second light.
  • Page 61: Rescaling Normals

    As of Release 1.05 of HP’s implementation of OpenGL 1.1, the GL_RESCALE_NORMAL_EXT token is supported. It is accepted by the <cap> parameter of glEnable, glDisable, and glIsEnabled, and by the <pname>...
  • Page 62 If normalization is disabled, then the square root in equation 2.1 is replaced with 1; otherwise, it is calculated as dictated by the OpenGL Spec. If both normalize and rescale are enabled, HP’s implementation skips the rescale and does only the normalize.