numarray and NumarrayType

Marco Bubke marco at bubke.de
Sat Jan 31 10:48:30 EST 2004


Hi

I have a little problem mit numarrays type. I want to get the Type but its
noch the right one. If I array.typecode() I get the right one but there is
not a typecode for all types. I geht the same type fer float and double?

Thats wrong. Its a bug by me or numarray?

Here is the code. The array is of type 'Float32" but I get tFloat64.

    cdef int numarray_type
    numarray_type = NA_NumarrayType(flat_array)
    if numarray_type == tFloat32:
      self.type = GL_FLOAT
    elif numarray_type == tFloat64:
      self.type = GL_DOUBLE
    elif numarray_type == tUInt32:
      self.type = GL_UNSIGNED_INT
    elif numarray_type == tInt32:
      self.type = GL_INT
    elif numarray_type == tUInt16:
      self.type = GL_UNSIGNED_SHORT
    elif numarray_type == tInt16:
      self.type = GL_SHORT
    elif numarray_type == tUInt8:
      self.type = GL_UNSIGNED_BYTE
    elif numarray_type == tInt8:
      self.type = GL_BYTE
    else:
      assert 0, "can't convert numarray type to opengl type"

regards

Marco



More information about the Python-list mailing list