Beispiel #1
0
    def update_glsl(self, nap):
        global numVertsDyrty
        global vertices3
        global normals3
        global texcoords3

        AM.RotVerts( 0.001, 0.001 )

        self.indRender += 1
        if self.indRender%200 == 0:
            print(nap, nap**-1)

        if self.ReloadVertewxes:
            (lv, lt) = AM.OutVerts(vertices, normals, texcoords, 0, 0)
            numVertsDyrty = lv # int(lv/3)

            vertices3 = vertices.tobytes('C')
            normals3 = normals.tobytes('C')
            texcoords3 = texcoords.tobytes('C') #а вот они, кстати, не меняются

            glUseProgram(shaderProgram)
            glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0,  vertices3 ) #а здесь можно попробовать на с 0 менять куски векторов
            glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0,  normals3 ) #.tobytes('C') )
            glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 0,  texcoords3 )
            #self.ReloadVertewxes = False

        glClearColor(0.25, 0.25, 0.25, 1.0)
        glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)

        glDrawArrays(GL_TRIANGLES, 0, numVertsDyrty)

        Window.flip()