def viewingMatrix(projection=None, model=None):
 if (projection is None):
  projection = GL.glGetDoublev(GL.GL_PROJECTION_MATRIX)
 if (model is None):
  model = GL.glGetDoublev(GL.GL_MODELVIEW_MATRIX)
 if ((projection is None) or (model is None)):
  context_log.warn('A NULL matrix was returned from glGetDoublev: proj=%s modelView=%s', projection, model)
  if projection:
   return projection
  if model:
   return model
  else:
   return numpy.identity(4, 'd')
 if numpy.allclose(projection, (-1.79769313e+308)):
  context_log.warn('Attempt to retrieve projection matrix when uninitialised %s, model=%s', projection, model)
  return model
 if numpy.allclose(model, (-1.79769313e+308)):
  context_log.warn('Attempt to retrieve model-view matrix when uninitialised %s, projection=%s', model, projection)
  return projection
 return numpy.dot(model, projection)

def viewingMatrix ( projection = None , model = None ) : if ( projection is None ) : projection = GL . glGetDoublev ( GL . GL_PROJECTION_MATRIX ) if ( model is None ) : model = GL . glGetDoublev ( GL . GL_MODELVIEW_MATRIX ) if ( ( projection is None ) or ( model is None ) ) : context_log . warn ( 'A NULL matrix was returned from glGetDoublev: proj=%s modelView=%s' , projection , model ) if projection : return projection if model : return model else : return numpy . identity ( 4 , 'd' ) if numpy . allclose ( projection , ( - 1.79769313e+308 ) ) : context_log . warn ( 'Attempt to retrieve projection matrix when uninitialised %s, model=%s' , projection , model ) return model if numpy . allclose ( model , ( - 1.79769313e+308 ) ) : context_log . warn ( 'Attempt to retrieve model-view matrix when uninitialised %s, projection=%s' , model , projection ) return projection return numpy . dot ( model , projection )
calculate the total viewing matrix from given data projection -- the projection matrix .