Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP's Implementation of OpenGL: HP 9000 Workstations > Chapter 6 Programming Hints

OpenGL Correctness Hints

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

Hints provided in this section are intended to help you correctly use HP's implementation of OpenGL.

4D Values

When specifying 4D values, such as vertices, light positions, etc, if possible supply a w value that is not near the floating point limits of MINFLOAT or MAXFLOAT. Using w values near the floating point limits increases the likelihood of floating point precision errors in calculations such as lighting, transformations, and perspective division.

Also, performance will be best when 4D positions are normalized such that w is 1.0.

For best accuracy and performance, if you want to specify some 4D position like (0.0, 0.0, 5e10, 1.5e38), instead use the equivalent normalized position (0.0, 0.0, 3.33e-28, 1.0).

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. This will eliminate an extra transformation of the light position, giving the best possible solution.

Texture Coordinates

When using non-orthographic projection, keep in mind the texture coordinates will be divided by w as an intermediate calculation. HP's implementation of OpenGL estimates that for VMD, the texture coordinates used in perspective projections will have only five significant digits of precision. Therefore, when you have texturing close to a window edge and the decomposition of the primitive causes the vertices to have very closely-spaced texture coordinates after perspective projection, you may see loss of texturing precision. This loss of precision may make the texture primitive seem locally smeared.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1996 Hewlett-Packard Development Company, L.P.