wrong result in on_draw() event · Issue #312 · glumpy/glumpy · GitHub
Skip to content

wrong result in on_draw() event #312

Description

@gw00295652

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions