def build_texture_from_image(img): from texture import Texture height, width = img.shape[:2] tex = Texture(GL_TEXTURE_2D, 1, GL_RGB8, width, height) tex.sub_image(0, 0, 0, width, height, GL_BGR, GL_UNSIGNED_BYTE, img) return tex