`GL`
Prev | Chapter 2. Upgrading From PyOpenGL 1.5 | Next

## `GL`

`glCleanRotMat` – Not Available. This utility function attempted to recover from precision errors encountered with multiple matrix rotations. This seems like an inelegant approach to the situation. Consider using quaternion addition (see `OpenGL/quaternion.py`) or single rotation calls.

`glSaveTIFF`, `glSaveJPEG`, `glSavePPM` – Not Available. These functions attempted to save a file in a particular format directly from the OpenGL context. They largely duplicated effort both from the Python Imaging Library (PIL) (image handling) and python itself (file handling). Since `glReadPixels` is fully functional under PyOpenGL, these functions were not provided. See `OpenGLContext/tests/saveimage.py` for demonstration code showing how to save an image using PIL

`glTetrahedra` – Not Available. This does not seem like something that needs to be in the core library.

`glTriangleNormals`, `glIndexedGeomDSPL`, `glTrianglesWithNormals`, `glLines`, `glPoints` – Not Available . These functions provide somewhat higher level rendering mechanisms for a small subset of geometry types. They do not really seem to be something that belongs in the core library. Although they may be implemented in a utility library at a later date for legacy purposes, at the present time they are not supported.

`glGetError`. See Error Handling above for rationale. You will need to either define a nop function `glGetError`, or remove all instances of `glGetError`.

`glGetBooleanv`, `glGetFloatv`, `glGetDoublev`, `glGetIntegerv` – Changed Behavior. The `glGetX` family of functions no longer chooses a single default type for each argument, instead, it returns the type appropriate to the explicitly named function. For instance,

    >>> glGetInteger( GL_MODELVIEW_MATRIX )
    [[1 0 0 0]
     [0 1 0 0]
     [0 0 1 0]
     [0 0 0 1]]

You will need to search for each `glGetX` call and determine if the call really intended to use the function named, or whether it was relying on the looser semantics of the original functions.

`glXPointer` Family – Changed Behavior. There are now two major variants of these functions. The first variant, spelled with the appropriate type decoration `{d|f|i|b|ub}` takes a two- dimensional python (or Numeric) array as its single argument:

    glVertexPointerd([[0.0, 0.0, 0.0], # note need for 2-d array!
                      [5.0, 0.0, 0.0], # Changed with PyOpenGL 2
                      [5.0, 5.0, 0.0],
                      [0.0, 5.0, 0.0]])

The second variant allows you to specify a string argument, as well as the stride argument, and matches the semantics of the underlying OpenGL function.

    glVertexPointer(3, GL_DOUBLE, 0, vertices.tostring())

### Note

`glInterleavedArrays` is not part of this family and requires a string, not an array argument

`glVertex` - Changed Behavior. `glVertex` no longer supports passing in arrays of points, you will need to convert your code to using `glVertexPointer{d|f}`.

`glColor2Vertexd`, `glColor2Vertex` – Not Available. Like `glVertex` this functionally should be replaced using `glVertexPointer` and `glColorPointer`.

Function Aliases. PyOpenGL 1.5 provided a number of convenience names which were aliases for decorated function names. To preserve code compatibility, many of these functions are now available within PyOpenGL 2.

Function Aliases

`glGetBooleanv` aliases
  `glGetBoolean`
`glGetDoublev` aliases
  `glGetDouble`
`glGetIntegerv` aliases
  `glGetInteger`
`glColord` aliases

  `glColor`
  `glColor3`
  `glColor4`

`glEvalCoordd` aliases

  `glEvalCoord`
  `glEvalCoord1`
  `glEvalCoord2`

`glFogfv` aliases
  `glFog`
`glIndexd` aliases
  `glIndex`
`glLightfv` aliases
  `glLight`
`glLightModelfv` aliases
  `glLightModel`
`glMaterialfv` aliases
  `glMaterial`
`glNormald` aliases

  `glNormal`
  `glNormal3`
  `glNormal4`

`glRasterPosd` aliases

  `glRasterPos`
  `glRasterPos2`
  `glRasterPos3`
  `glRasterPos4`

`glRotated` aliases
  `glRotate`
`glScaled` aliases
  `glScale`
`glTexCoordd` aliases

  `glTexCoord`
  `glTexCoord1`
  `glTexCoord2`
  `glTexCoord3`
  `glTexCoord4`

`glTexGendv` aliases
  `glTexGen`
`glTexParameterfv` aliases
  `glTexParameter`
`glTranslated` aliases
  `glTranslate`
`glVertexd` aliases
  `glVertex`

Prev | Home | Next
Error Handling | Up | `GLUT`