M
Marco Bubke
Hi
Ok, I get a reproduceable seqmentation fault.
Ok, fist the code:
cdef NumArray array_to_double(NumArray array):
# maybe here is memoty leak!
cdef NumArray flat_array_obj
flat_array_obj = NA_InputArray(NA_updateDataPtr(array), tFloat64,
NUM_C_ARRAY)
return flat_array_obj
cdef NumArray array_to_int(NumArray array):
# maybe here is memoty leak!
cdef NumArray flat_array_obj
flat_array_obj = NA_InputArray(NA_updateDataPtr(array), tInt32,
NUM_C_ARRAY)
return flat_array_obj
def un_project(GLdouble winx, GLdouble winy, GLdouble winz, NumArray model
not None, NumArray proj not None, NumArray viewport not None):
assert NA_elements(model) == 16 and NA_elements(proj) == 16 and
NA_elements(viewport) == 4,\
"modelview matrix, projection matrix or viewport ar of the wrong size"
# cdef GLdouble objx
# cdef GLdouble objy
# cdef GLdouble objz
# cdef NumArray flat_model
# cdef NumArray flat_proj
cdef NumArray flat_view
# flat_model = array_to_double(model)
# flat_proj = array_to_double(proj)
flat_view = array_to_int(viewport) <<<<<<<<<<<<<<<<<<<<<<<
# success = gluUnProject(winx, winy, winz,
<double*>NA_OFFSETDATA(flat_model), <double*>NA_OFFSETDATA(flat_proj),
<int*>NA_OFFSETDATA(flat_view), &objx, &objy, &objz)
# assert success, 'failure in the unprojection'
cdef NumArray new_array
new_array = NA_NewArray(NULL, tFloat32, 1, 3)
# new_array.fromlist([objx, objy, objz])
return new_array
Ok, its in Pyrex and has a bug in
flat_view = array_to_int(viewport),
but I don't know why. If I change the code to
flat_view = array_to_double(viewport)
its runnig without glitches. I really dont understand it.
Thx
Marco
Ok, I get a reproduceable seqmentation fault.
Ok, fist the code:
cdef NumArray array_to_double(NumArray array):
# maybe here is memoty leak!
cdef NumArray flat_array_obj
flat_array_obj = NA_InputArray(NA_updateDataPtr(array), tFloat64,
NUM_C_ARRAY)
return flat_array_obj
cdef NumArray array_to_int(NumArray array):
# maybe here is memoty leak!
cdef NumArray flat_array_obj
flat_array_obj = NA_InputArray(NA_updateDataPtr(array), tInt32,
NUM_C_ARRAY)
return flat_array_obj
def un_project(GLdouble winx, GLdouble winy, GLdouble winz, NumArray model
not None, NumArray proj not None, NumArray viewport not None):
assert NA_elements(model) == 16 and NA_elements(proj) == 16 and
NA_elements(viewport) == 4,\
"modelview matrix, projection matrix or viewport ar of the wrong size"
# cdef GLdouble objx
# cdef GLdouble objy
# cdef GLdouble objz
# cdef NumArray flat_model
# cdef NumArray flat_proj
cdef NumArray flat_view
# flat_model = array_to_double(model)
# flat_proj = array_to_double(proj)
flat_view = array_to_int(viewport) <<<<<<<<<<<<<<<<<<<<<<<
# success = gluUnProject(winx, winy, winz,
<double*>NA_OFFSETDATA(flat_model), <double*>NA_OFFSETDATA(flat_proj),
<int*>NA_OFFSETDATA(flat_view), &objx, &objy, &objz)
# assert success, 'failure in the unprojection'
cdef NumArray new_array
new_array = NA_NewArray(NULL, tFloat32, 1, 3)
# new_array.fromlist([objx, objy, objz])
return new_array
Ok, its in Pyrex and has a bug in
flat_view = array_to_int(viewport),
but I don't know why. If I change the code to
flat_view = array_to_double(viewport)
its runnig without glitches. I really dont understand it.
Thx
Marco