I got a wrong result when I call on_draw() function which include a for loop to upload different texture.
There is my code:
@window.event
def on_draw(dt): \\n
window.clear((0, 0, 0, 1))
gl.glDisable(gl.GL_BLEND)
gl.glEnable(gl.GL_DEPTH_TEST)
for i, j in enumerate(region_index):
vertices = np.zeros(4, vtype)
vertices["position"] = np.array(self.regions["Grids"][j]["vertexs"]).reshape(4, -1)
vertices["texcoord"] = np.array(self.regions["Grids"][j]["texcoords"]).reshape(4, -1)
vertices = vertices.view(gloo.VertexBuffer)
indices = self.indices.view(gloo.IndexBuffer)
grid.bind(vertices)
grid["homo"] = self.homo[dic[image_index[i]]]
grid["texture"] = images[image_index[i]]
grid.draw(gl.GL_TRIANGLES, indices)
I use region_index = [1, 3, 5, 7] image_index = [3, 0, 2, 1], it produces wrong result.
But when I use "region_index = [1] image_index = [3]" or "region_index = [2] image_index = [0]" and so on, it produce right result.
I got a wrong result when I call on_draw() function which include a for loop to upload different texture.
There is my code:
I use region_index = [1, 3, 5, 7] image_index = [3, 0, 2, 1], it produces wrong result.
But when I use "region_index = [1] image_index = [3]" or "region_index = [2] image_index = [0]" and so on, it produce right result.