Re: [PyOpenGL-Users] Pyopengl - slow performance using
Brought to you by:
mcfletch
From: Christopher B. <Chr...@no...> - 2011-01-18 20:27:28
|
On 1/17/11 2:24 PM, Jonathan Hartley wrote: > Personally I use ctypes arrays instead of numpy arrays. > But for what it's worth, the ctypes code is quite > simple. From memory, assuming 3D vertices: > > from OpenGL import GL as gl > > # prepare the arrays once at application start-up or model load: > > verts = [ (1.0, 2.0, 3.0), (4.0, 5.0, 6.0)... ] > length = len(verts) * 3 # each vertex has three ordinates, (x, y, z) > arraytype = gl.GLfloat * length > glverts = arraytype(*verts) sure but compare that to: verts = [ (1.0, 2.0, 3.0), (4.0, 5.0, 6.0)... ] glverts = np.array(verts, dtype=np.float32) but if you're not using numpy for anything else, ctypes arrays are a fine option. > If anyone anyone else's response contradicts the above, they are almost > certainly more correct. :-) Maybe, but that was really helpful info and pointers, thanks! -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |