this is the code i know is making the errors
self.scale_loc = glGetUniformLocation(shader, b"scale")
self.rotate_loc = glGetUniformLocation(shader, b"rotate")
self.scale = pyrr.Matrix44.identity()
self.rot_y = pyrr.Matrix44.identity()
def rotate(self):
self.scale = pyrr.Matrix44.from_scale(pyrr.Vector3([0.2, 0.2, 1.0])).flatten()
self.rot_y = pyrr.Matrix44.from_y_rotation(time.perf_counter() * 2).flatten
#self.rot_y = [y for x in self.rot_y for y in x]
c_scale = (GLfloat * len(self.scale))(*self.scale)
c_rotate_y = (GLfloat * len(self.rot_y))(*self.rot_y)
glUniformMatrix4fv(self.scale_loc, 1, GL_FALSE, c_scale)
glUniformMatrix4fv(self.rotate_loc, 1, GL_FALSE, c_rotate_y)
the error is
c_rotate_y = (GLfloat * len(self.rot_y))(*self.rot_y)
TypeError: object of type 'builtin_function_or_method' has no len()
i don't know if it is outdated or what. im following a 4 years old tutorial series. let me know if you need anymore information
Pyrr - Matrices are represented by 2 dimensional NumPy arrays. To convert the NumPy array to a ctypes
you have to flatten
it. The number of elements in the array can be get from the size
attribute:
self.scale = pyrr.Matrix44.from_scale(pyrr.Vector3([0.2, 0.2, 1.0])).flatten()
self.rot_y = pyrr.Matrix44.from_y_rotation(time.perf_counter() * 2).flatten()
c_scale = (GLfloat * self.scale.size)(*self.scale)
c_rotate_y = (GLfloat * self.rot_y.size)(*self.rot_y)
glUniformMatrix4fv(self.scale_loc, 1, GL_FALSE, c_scale)
glUniformMatrix4fv(self.rotate_loc, 1, GL_FALSE, c_rotate_y)