On Jun 30, 2009, at 7:08 PM, Ondrej Certik wrote: > On Tue, Jun 30, 2009 at 7:30 PM, Lisandro Dalcin<[email protected]> > wrote: >> On Tue, Jun 30, 2009 at 10:14 PM, Ondrej Certik<[email protected]> >> wrote: >>> >>> Ah, I think I am wrong. Numpy's strides is exactly what I need, >>> right? >>> >>> http://docs.scipy.org/doc/numpy/reference/generated/ >>> numpy.ndarray.strides.html >>> >>> so I just take *any* numpy array, as long as it has the right >>> dtype, >>> and then just pass the pointer to .data and strides to the opengl >>> function. >>> >> >> Perhaps it works... Just in case, test it with a numpy array using >> Fortran ordering, perhaps OpenGL does not like it? > > So far all functions in opengl use 1D arrays only. > >> >> BTW, do arrays with more than two dimensions make sense in OpenGL? Do >> you know exactly what numpy strides mean (any nd-array have >> nd-strides, even the contiguous ones) ? > > Yes, a stride is the number of bytes you need to move your pointer to > get to the next element in the array. opengl only accepts 1D arrays, > but it *does* accept a stride. > > Can it happen, that a 1D numpy array has stride which is bigger than > sizeof(dtype)? so far I didn't manage to create one.
Yes. sage: a = numpy.zeros(10)[::5] sage: a.strides (40,) - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
