Hi there,
I just installed and tried glumpy and stumbled over several compatibility issues with numpy.
I'm using
on Windows 11
OpenGL shading language version : 4.60 NVIDIA
OpenGL ES shading language version : 3.2
I can only speak for this version of numpy, but I think this is starting with numpy 2.0
- in /gloo/variable.py
in class Uniform(Variable):
in def set_data(self, data):
line 280:
self._data[...] = np.array(data,copy=False).ravel()
copy=false rises an error
accroding to numpy (https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword) np.asarray is preferred over np.array and can mostly be used without copy=false.
So I changed this line to
self._data[...] = np.asarray(data).ravel()
and the error disappears
in this file are many other lines with np.array(data,copy=False) - maybe they need to be changed, too?
-
in /gloo/program.py
in function def active_uniforms(self):
in line 453/454:
name, size, gtype = gl.glGetActiveUniform(self.handle, i)
name = name.decode()
name.decode rises an error
'numpy.ndarray' object has no attribute 'decode'
the name returned by gl.glGetActiveUniform is:
[117 95 118 105 101 119 0 0 0 0 0 0 0 0 0 0 0 0]
(wich is 'u_view' in ASCII)
dunno if this GL-version dependant?
so I made a workaround :
name = name.tobytes().decode("ascii").strip()
name = ''.join(char for char in name if (ord(char) > 32 and ord(char) < 128))
wich fixed it
(first line is converting to ASCII - second line removes the "0" chars)
Maybe there have been made changes to the decode function?
Cheers,
Stephan
Hi there,
I just installed and tried glumpy and stumbled over several compatibility issues with numpy.
I'm using
on Windows 11
OpenGL shading language version : 4.60 NVIDIA
OpenGL ES shading language version : 3.2
I can only speak for this version of numpy, but I think this is starting with numpy 2.0
in class Uniform(Variable):
in def set_data(self, data):
line 280:
self._data[...] = np.array(data,copy=False).ravel()copy=false rises an error
accroding to numpy (https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword) np.asarray is preferred over np.array and can mostly be used without copy=false.
So I changed this line to
self._data[...] = np.asarray(data).ravel()and the error disappears
in this file are many other lines with np.array(data,copy=False) - maybe they need to be changed, too?
in /gloo/program.py
in function def active_uniforms(self):
in line 453/454:
name.decode rises an error
'numpy.ndarray' object has no attribute 'decode'the name returned by gl.glGetActiveUniform is:
[117 95 118 105 101 119 0 0 0 0 0 0 0 0 0 0 0 0](wich is 'u_view' in ASCII)
dunno if this GL-version dependant?
so I made a workaround :
wich fixed it
(first line is converting to ASCII - second line removes the "0" chars)
Maybe there have been made changes to the decode function?
Cheers,
Stephan