Re: [PyOpenGL-Users] Pyopengl - slow performance using
Brought to you by:
mcfletch
From: Chris B. <Chr...@no...> - 2011-01-14 02:45:26
|
On 1/13/2011 3:17 PM, Ian Mallett wrote: > > doing this. Python lists are just linked lists, > > no, they are not -- they are internally regular C arrays. > > But they are resizable, which implies they are either linked lists or > array lists--because I doubt the pointers are copied over to a brand-new > array just big enough each time a single element is added or removed. A bit OT, but they handle re-sizing by over allocating when appended to. So most of the time you can append to a list without any memory allocation or copying, but as it grows, it does need to do that once in a while. linked lists would be great for appending, but horrible for indexing and slicing. But anyway, the original point is correct -- python lists don't store the data in a way that is compatible with OpenGL, so a lot of work has to be done to create OpenGL objects from lists -- numpy arrays are really just wrappers around blocks of memory, so they can efficiently be used to move data in and out of OpenGL. -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... |