Is there a way to resize and or remove entries from a GLM array?

So far I discovered (python):


which will create an array of 100 entries of glm.float32. The I discovered:

narray = glm.concat(array1,array2)

which returns a new array narray which is the conglomeration of both respectively.

So is there a way that GLM is providing at this time or maybe in future releases to resize an array and/or remove entries (such as a cut feature)?

This is rather specific to PyGLM, since AFAIK regular GLM (for C++) does not even have an array type and one would use something like std::vector or std::array based on e.g. whether the size is known at compile time.
According to the documentation you can use del array[idxS:idxE] to remove the range of indices from idxS to idxE (exclusive) from an array. However, my impression is that is not the preferred/intended (?) use case for PyGLM’s array. It seems to mostly target transferring data to or from the OpenGL implementation, e.g. when used with glBufferData. For dynamically sized things a python list seems a better fit.

There’s no advantage to using Python’s lists here. They should only be used for heterogeneous arrays (i.e. where elements aren’t required to have the same type). They should never be used for data which will be passed to C or C++ functions as a (slow) data conversion will always have to be performed, whereas a homogeneous array (e.g. GLM or NumPy array) of the correct type can be passed by reference.

1 Like