HP Workstation zx2000 Implementation Manual
HP Workstation zx2000 Implementation Manual

HP Workstation zx2000 Implementation Manual

Hp opengl implementation guide for hp-ux 11.x (ipf version) (5969-3152)
Hide thumbs Also See for Workstation zx2000:
Table of Contents

Advertisement

Quick Links

OpenGL implementation guide
for HP-UX 11.X (IPF version)
Document Part Number: 5969-3152
june 2003

Advertisement

Table of Contents
loading

Summary of Contents for HP Workstation zx2000

  • Page 1 OpenGL implementation guide for HP-UX 11.X (IPF version) Document Part Number: 5969-3152 june 2003...
  • Page 2 X/Open® is a registered trademark, and the X device is a trademark of X/Open Company Ltd. in the UK and other countries. Hewlett-Packard Company shall not be liable for technical or editorial errors or omissions contained herein or for incidental or consequential damages in connection with the furnishing, performance, or use of this material. The information in this document is provided “as is”...
  • Page 3: Table Of Contents

    contents 1 overview of OpenGL introduction ..............1–1 the OpenGL product.
  • Page 4 Contents 4 compiling and linking programs overview............... 4–1 including header files .
  • Page 5: Overview Of Opengl

    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. The information in this manual is valid only for OpenGL on IPF. For information on OpenGL on PA-RISC, refer to the PA-RISC version of the OpenGL Implementation Guide.
  • Page 6: Hp's Implementation Of Opengl

    overview of OpenGL 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 ■...
  • Page 7: Supported Visuals

    overview of OpenGL 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” on page 1-4.
  • Page 8: Visual Support For Other Graphics Devices

    overview of OpenGL stereo visual support for ATI Fire GL4 When a monitor is configured in a stereo capable mode, ATI Fire GL4 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”...
  • Page 9: Threads Support

    overview of OpenGL threads support OpenGL supports 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.so (not the archived version, libpthread.a).
  • Page 10: Standard Opengl Product

    overview of OpenGL 64-bit programming For information on porting your application to take advantage of 64-bit capabilities, see the http://docs.hp.com Web site. Search for “64-bit Computing” to find the topic on “Porting.” 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.
  • Page 11: Mixing Of Opengl And Xlib

    overview of OpenGL the OpenGL extensions for the X Window system (GLX) HP’s OpenGL implementation currently supports version 1.2 of the glx extension. The OpenGL Extension to the X Window System (GLX) provide routines for: ■ choosing a visual ■ managing the OpenGL rendering context ■...
  • Page 12: Opengl Extensions

    overview of OpenGL OpenGL extensions The extensions listed in this section are extensions that HP has created; that is, in addition to those standard functions described in the OpenGL Programming Guide, OpenGL Reference Manual, and OpenGL Programming for the X Window System. draw array set extension For additional information, see Chapter 5, “programming hints.”...
  • Page 13 overview of OpenGL GL_LINEAR_MIPMAP_LINEAR Filtering may use Two Blocks Enumerated Types for 3D Texturing Extended Area Enumerated Type Description Pixel Storage GL_[UN]PACK_IMAGE_HEIGHT_EXT The height of the image from which the Default: 0 for each texture is created; it supersedes the value of the height passed into glTexImage3DEXT.
  • Page 14 overview of OpenGL 3D texture program fragments This program draws four layers in the base MIPmap level, and a diagonal slice through the base MIPmap level. /* Allocate texture levels separately, then concat to get 3D texture */ GLubyte texture1[TEXTURE_WIDTH][TEXTURE_HEIGHT][4]; GLubyte texture2[TEXTURE_WIDTH][TEXTURE_HEIGHT][4];...
  • Page 15 overview of OpenGL GLubyte purpleRGBA[]= {255.0, 0.0, 255.0, 255.0}; GLubyte cyanRGBA[]= {0.0, 255.0, 255.0, 255.0}; GLubyte greyRGBA[] = {125.0, 125.0, 125.0, 255.0}; main(int argc, char *argv[]) { /* Open window for displaying.Put your favorite code here to open a window and perform perspective setup */ glEnable(GL_TEXTURE_3D_EXT);...
  • Page 16: Occlusion Extension

    overview of OpenGL glVertex3f(0.5, 62.5, 0.); glNormal3f(0., 0., 1.); glTexCoord3f(1.0, 1.0, 1.0); glVertex3f(62.5, 62.5, 0.); glNormal3f(0., 0., 1.); glTexCoord3f(1.0, 0.0, 1.0); glVertex3f(62.5, 0.5, 0.); glEnd(); The results of code fragments are shown in Results from the 3D Texture Program Fragments below.
  • Page 17: Occlusion Culling Code Fragments

    overview of OpenGL occlusion culling code fragments The following is a sample code segment that shows a simple usage of occlusion culling. /* Turn off writes to depth and color buffers */ glDepthMask(GL_FALSE); glColorMask (GL_FALSE, GL_FALSE, GL_FALSE); /* Enable Occlusion Culling test */ glEnable(GL_OCCLUSION_TEST_HP);...
  • Page 18: Visibility Test Extension

    overview of OpenGL visibility test extension The Visibility Test extension provides a way for an application to test whether or not a primitive or set of primitives are visible against the current contents of the depth buffer. "Visibile" in this context means that at least one pixel passes the depth test.
  • Page 19 overview of OpenGL The following is a sample code segment of how the visibility test extension might be used. #define NUMTESTS 1000 GLboolean visBuffer[NUMTESTS], visstuff[2]; glVisibilityBufferHP(NUMTESTS,visBuffer,GL_TRUE); glEnable(GL_VISIBILITY_TEST_HP); // We don't actually want to touch the Color or Depth buffers... glDepthMask(GL_FALSE); glColorMask(GL_FALSE, GL_FALSE,GL_FALSE,GL_FALSE);...
  • Page 20: Texture Autogen Mipmap Extension

    overview of OpenGL texture autogen MIPmap extension The autogen MIPmap extension introduces a side effect to the modification of the base level texture map. When enabled, any change to the base-level texture map will cause the computation of a complete MIPmap stack form for that base level. The internal formats and border widths of the derived MIPmap will match those of the base map, and the dimensions of the derived MIPmap follow the requirements set forth in OpenGL for a valid MIPmap.
  • Page 21 overview of OpenGL Enumerated Types for GLX Visual Information Extended Area Enumerated Types Description Visual Type GLX_TRUE_COLOR_EXT, Values associated with the GLX_DIRECT_COLOR_EXT, GLX_X_VISUAL_TYPE_EXT GLX_PSEUDO_COLOR_EXT, eumerated type GLX_STATIC_COLOR_EXT* GLX_GRAY_SCALE_EXT* GLX_STATIC_GRAY_EXT* Default: N/A Visual Transparency GLX_NONE__EXT, Values associated with the Capabilities GLX_TRANSPARENT_RGB_EXT* GLX_TRANSPARENT_TYPE_EXT GLX_TRANSPARENT_INDEX_EXT enumerated type...
  • Page 22 overview of OpenGL GLX_EXT_visual_info program fragments Note that both of the following segments assume that the GLX_EXT_visual_info extension exists for dpy, which is a pre-existing display connection to an X Server. Here is a sample code segment that forces selection of a TrueColor visual. Display *dpy;...
  • Page 23: Rendering Details

    overview of OpenGL rendering details This section provides the details for several of HP’s rendering capabilities. These rendering capabilities range from the way HP implements its default visuals to the way HP deals with the decomposition of concave quadrilaterals. default visuals Instead of placing the default visual in the deepest image buffer, HP puts the default visual in the overlay planes.
  • Page 24: Environment Variables

    overview of OpenGL environment variables Here is a list of environment variables used by HP’s implementation of OpenGL. HPOGL_FORCE_VGL This variable can be set to force HP’s Virtual GL (VGL) rendering mode using VMD. This differs from HPOGL_FORCE_VMD in that the GLX Visual list and other GLX extension information is not retrieved from the GLX Server extension, but is rather synthesized from standard X Visual information and the capabilities known to exist in VMD.
  • Page 25: Installation And Setup

    installation and setup If you are setting up a new workstation, all software is preloaded for you if you purchased the Instant Ignition option. A subsequent section will explain how to determine if OpenGL has been installed. If you did not order Instant Ignition, then you will need to install the OpenGL filesets. For HP-UX 11.X, the box containing the “HP-UX 11.0 Install and Core OS”...
  • Page 26: Installing Opengl

    installation and setup installing OpenGL Installing the software involves the following steps: 1. Read this entire procedure. 2. Install OpenGL. 3. Check log file. 4. Verify the product. Each step is described on the subsequent sections. 1. read this entire procedure Read all of this procedure to ensure the proper installation of your OpenGL product.
  • Page 27: Check Log File

    installation and setup 3. check log file After you have completed the installation process, look at /var/adm/sw/swinstall.log. This file lists the filesets loaded, the customize scripts that ran during the installation process, and informative messages. Error messages that resulted from attempts to write across an NFS mount point may appear in this file and, if present, may be ignored.
  • Page 28 installation and setup These directories contain extension libraries that are needed to run OpenGL with the X Server. /opt/graphics/common/lib/hpux32 /opt/graphics/common/lib/hpux64 These directories contain run time shared libraries that are needed to run OpenGL. The other libraries you will see in these directories are all drivers for specific graphics devices. All libdd...
  • Page 29: Running Opengl Programs

    running OpenGL programs This chapter describes Virtual GLX mode, Virtual Memory Driver (VMD), and support of stereo applications. virtual 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 30: Running Hp's Implementation Of The Opengl Stereo Application

    running OpenGL programs ■ The glReadPixels routine when used in the VGL mode will return only pixel data rendered via OpenGL. Xlib rendering will not be included. ■ Because of the way VMD works (rendering to a VM buffer and then displaying the images through X11 protocol), it will behave a bit differently than hardware devices.
  • Page 31: 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. overview The table below 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.
  • Page 32: Including Header Files

    compiling and linking programs including header files Most OpenGL programs and applications that use only the standard OpenGL data types, definitions, and function declarations, need include only the header file gl.h. To include this file, use the following syntax: #include <GL/gl.h> Still other header files may be needed by your program, depending on your application.
  • Page 33: Compiling 32-Bit And 64-Bit Applications For Opengl

    compiling and linking programs This table summarizes the shared libraries that are linked on the command line example above. Shared Libraries Library Description libGL OpenGL loader library libGLU OpenGL utility library libX11 X11 routines libXext X11 extensions libXhp11 HP X11 extension compiling 32-bit and 64-bit applications for OpenGL Sample 32-bit compile and link: cc -Ae -I/opt/graphics/OpenGL/include \...
  • Page 34 compiling and linking programs 4–4 OpenGL implementation guide...
  • Page 35: Programming Hints

    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 specific, see Appendix G in the OpenGL Programming Guide and section 6.6 “Maximizing OpenGL Performance”...
  • Page 36: Display List Performance

    programming hints display list performance The topics covered here are areas where you can gain substantial improvements in program performance when using OpenGL display lists. Here is a list of the topics that are covered: ■ geometric primitives ■ GL_COMPILE_AND_EXECUTE mode ■...
  • Page 37: Using Gldrawarraysethp

    programming hints The amount of performance benefit depends upon several factors, including the number of primitives in the set, the length of the primitives in the set, and maximum rendering speed of the graphics device. To achieve optimum glDrawArraySetHP rendering performance, group as many primitives in each set as possible.
  • Page 38: State Changes And Their Effects On Display Lists

    programming hints state changes and their effects on display lists If there are several state changes in a row, it is possible, in some circumstances, for the display list to optimize them. It is more efficient to put a state change before a glBegin, than after it. For example, this is always more efficient: glColor3f(1,2,3);...
  • Page 39: Texture Downloading Performance

    programming hints Performance is increased by maximizing the number of vertices per Begin/End pair. If your vertex data in memory is organized in a linear, rather than a random manner, performance is enhanced by taking advantage of vertex pre-fetch. It is most efficient to use 32-bit float data, which avoids the need to convert data.
  • Page 40: Optimization Of Lighting

    programming hints These calls cannot occur between a glBegin/glEnd pair. Examples of such commands are: glEnable(GL_LIGHTING); glFogf(GL_FOG_MODE, GL_LINEAR); glLightf(..); glLoadMatrixf(..); Changes to the modal state are significantly more expensive to process than simple vertex-data commands. Also, application performance can be optimized by grouping modal-state changes, and by minimizing the number of modal-state changes: ■...
  • Page 41: Rescaling Normals

    programming hints rescaling normals When normal rescaling is enabled, a new operation is added to the transformation of the normal vector into eye coordinates. The normal vector is rescaled after it is multiplied by the inverse modelview matrix and before it is normalized. The rescale factor is chosen so that in many cases, normal vectors with unit length in object coordinates will not need to be normalized as they are transformed into eye coordinates.
  • Page 42 programming hints If rescaling is disabled, f is 1, otherwise f is computed as follows: Let m denote the matrix element in row i and column j of M , numbering the topmost row of the matrix as row 1, and the left most column as column 1. Then Alternatively, an implementation may choose to normalize the normal instead of rescaling the normal.

This manual is also suitable for:

Workstation zx6000

Table of Contents