def set_texture(self, mat_name, smplr_name, texture):
# texture_image: H x W x 3
width = texture.shape[1]
height = texture.shape[0]
texture = np.flip(texture, 0)
img_data = np.fromstring(texture.tostring(), np.uint8)
if mat_name not in self.render_texture_mat:
self.render_texture_mat[mat_name] = {}
if smplr_name in self.render_texture_mat[mat_name].keys():
glDeleteTextures([self.render_texture_mat[mat_name][smplr_name]])
del self.render_texture_mat[mat_name][smplr_name]
self.render_texture_mat[mat_name][smplr_name] = glGenTextures(1)
glActiveTexture(GL_TEXTURE0)
# glGenTextures(1, self.render_texture_mat[mat_name][smplr_name])
# glPixelStorei(GL_UNPACK_ALIGNMENT, 1)
glBindTexture(GL_TEXTURE_2D, self.render_texture_mat[mat_name][smplr_name])
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, img_data)
glGenerateMipmap(GL_TEXTURE_2D)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 3)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR)
When the code execute in line glGenerateMipmap(GL_TEXTURE_2D), it turns out with error:
without any other error, could you please tell me how to fix the bug? or if the code is with some error.
BTW, my PyOpenGL & PyOpenGL-accelerate is 3.1.5
the CUDA version is 11.4
Hi,I've found an error as follows:
When the code execute in line glGenerateMipmap(GL_TEXTURE_2D), it turns out with error:
without any other error, could you please tell me how to fix the bug? or if the code is with some error.
BTW, my PyOpenGL & PyOpenGL-accelerate is 3.1.5 the CUDA version is 11.4